Skip to content

Commit

Permalink
fix: Enable users to upgrade a batch source into a push source (feast…
Browse files Browse the repository at this point in the history
…-dev#3213)

Signed-off-by: Danny Chiao <danny@tecton.ai>

Signed-off-by: Danny Chiao <danny@tecton.ai>
  • Loading branch information
adchia committed Sep 26, 2022
1 parent a2dc0d0 commit 8f2fb58
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
8 changes: 3 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ benchmark-python-local:
FEAST_USAGE=False IS_TEST=True FEAST_IS_LOCAL_TEST=True python -m pytest --integration --benchmark --benchmark-autosave --benchmark-save-data sdk/python/tests

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

test-python-integration:
FEAST_USAGE=False IS_TEST=True python -m pytest -n 8 --integration sdk/python/tests
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/feast/data_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ def __init__(

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

if not super().__eq__(other):
return False
Expand Down
26 changes: 25 additions & 1 deletion sdk/python/tests/unit/diff/test_registry_diff.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pandas as pd

from feast import Field
from feast import Field, PushSource
from feast.diff.registry_diff import (
diff_registry_objects,
tag_objects_for_keep_delete_update_add,
Expand Down Expand Up @@ -145,3 +145,27 @@ def post_changed(inputs: pd.DataFrame) -> pd.DataFrame:
feast_object_diffs.feast_object_property_diffs[2].property_name
== "user_defined_function.body_text"
)


def test_diff_registry_objects_batch_to_push_source(simple_dataset_1):
with prep_file_source(df=simple_dataset_1, timestamp_field="ts_1") as file_source:
entity = Entity(name="id", join_keys=["id"])
pre_changed = FeatureView(
name="fv2",
entities=[entity],
source=file_source,
)
post_changed = FeatureView(
name="fv2",
entities=[entity],
source=PushSource(name="push_source", batch_source=file_source),
)

feast_object_diffs = diff_registry_objects(
pre_changed, post_changed, "feature view"
)
assert len(feast_object_diffs.feast_object_property_diffs) == 1
assert (
feast_object_diffs.feast_object_property_diffs[0].property_name
== "stream_source"
)

0 comments on commit 8f2fb58

Please sign in to comment.