Skip to content

Commit 1b312fb

Browse files
authored
fix: Enable users to upgrade a batch source into a push source (#3213)
Signed-off-by: Danny Chiao <[email protected]> Signed-off-by: Danny Chiao <[email protected]>
1 parent b48d36b commit 1b312fb

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

Makefile

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,9 @@ benchmark-python-local:
6363
FEAST_USAGE=False IS_TEST=True FEAST_IS_LOCAL_TEST=True python -m pytest --integration --benchmark --benchmark-autosave --benchmark-save-data sdk/python/tests
6464

6565
test-python:
66-
@(docker info > /dev/null 2>&1 && \
67-
FEAST_USAGE=False \
68-
IS_TEST=True \
69-
python -m pytest -n 8 sdk/python/tests \
70-
) || echo "This script uses Docker, and it isn't running - please start the Docker Daemon and try again!";
66+
FEAST_USAGE=False \
67+
IS_TEST=True \
68+
python -m pytest -n 8 sdk/python/tests \
7169

7270
test-python-integration:
7371
FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration sdk/python/tests

sdk/python/feast/data_source.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -760,7 +760,7 @@ def __init__(
760760

761761
def __eq__(self, other):
762762
if not isinstance(other, PushSource):
763-
raise TypeError("Comparisons should only involve PushSource class objects.")
763+
return False
764764

765765
if not super().__eq__(other):
766766
return False

sdk/python/tests/unit/diff/test_registry_diff.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pandas as pd
22

3-
from feast import Field
3+
from feast import Field, PushSource
44
from feast.diff.registry_diff import (
55
diff_registry_objects,
66
tag_objects_for_keep_delete_update_add,
@@ -145,3 +145,27 @@ def post_changed(inputs: pd.DataFrame) -> pd.DataFrame:
145145
feast_object_diffs.feast_object_property_diffs[2].property_name
146146
== "user_defined_function.body_text"
147147
)
148+
149+
150+
def test_diff_registry_objects_batch_to_push_source(simple_dataset_1):
151+
with prep_file_source(df=simple_dataset_1, timestamp_field="ts_1") as file_source:
152+
entity = Entity(name="id", join_keys=["id"])
153+
pre_changed = FeatureView(
154+
name="fv2",
155+
entities=[entity],
156+
source=file_source,
157+
)
158+
post_changed = FeatureView(
159+
name="fv2",
160+
entities=[entity],
161+
source=PushSource(name="push_source", batch_source=file_source),
162+
)
163+
164+
feast_object_diffs = diff_registry_objects(
165+
pre_changed, post_changed, "feature view"
166+
)
167+
assert len(feast_object_diffs.feast_object_property_diffs) == 1
168+
assert (
169+
feast_object_diffs.feast_object_property_diffs[0].property_name
170+
== "stream_source"
171+
)

0 commit comments

Comments
 (0)