Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
7383550
feat: updating protos to separate transformation
franciscojavierarceo Mar 17, 2024
6bcff8d
fixed stuff...i think
franciscojavierarceo Mar 17, 2024
ea58ace
updated tests and registry diff function
franciscojavierarceo Mar 18, 2024
1713313
updated base registry
franciscojavierarceo Mar 18, 2024
4a00c12
updated react component
franciscojavierarceo Mar 18, 2024
97a8bb6
formatted
franciscojavierarceo Mar 18, 2024
5190d6c
updated stream feature view proto
franciscojavierarceo Mar 18, 2024
23ae349
making the proto changes backwards compatable
franciscojavierarceo Mar 18, 2024
1d598d2
trying to make this backwards compatible
franciscojavierarceo Mar 20, 2024
81c6f82
caught a bug and fixed the linter
franciscojavierarceo Mar 20, 2024
7687e23
actually linted
franciscojavierarceo Mar 20, 2024
6507808
updated ui component
franciscojavierarceo Mar 20, 2024
f44c227
accidentally commented out fixtures
franciscojavierarceo Mar 20, 2024
dd2a5ca
Updated
franciscojavierarceo Mar 22, 2024
9ac6793
incrementing protos
franciscojavierarceo Mar 22, 2024
5a1db09
updated tests
franciscojavierarceo Mar 22, 2024
e6bf1e9
fixed linting issue and made backwards compatible
franciscojavierarceo Mar 22, 2024
0daf027
feat: Renaming OnDemandTransformations to Transformations
franciscojavierarceo Mar 24, 2024
9417006
updated proto name
franciscojavierarceo Mar 24, 2024
eff1497
renamed substrait proto
franciscojavierarceo Mar 24, 2024
ae19919
renamed substrait proto
franciscojavierarceo Mar 24, 2024
e34b604
updated
franciscojavierarceo Mar 24, 2024
9cd0ebe
updated
franciscojavierarceo Mar 25, 2024
7b9f180
updated integration test
franciscojavierarceo Mar 25, 2024
19544f4
missed one
franciscojavierarceo Mar 25, 2024
41524c9
updated to include Substrait type
franciscojavierarceo Mar 25, 2024
7de39ab
linter
franciscojavierarceo Mar 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Updated
Signed-off-by: Francisco Javier Arceo <franciscojavierarceo@users.noreply.github.com>
  • Loading branch information
franciscojavierarceo committed Mar 24, 2024
commit dd2a5ca5fc6d35308586fa2ead112be5e4f2fa8c
4 changes: 2 additions & 2 deletions protos/feast/core/OnDemandFeatureView.proto
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ message OnDemandFeatureViewSpec {
map<string, OnDemandSource> sources = 4;

oneof transformation {
UserDefinedFunction user_defined_function = 5;
OnDemandSubstraitTransformation on_demand_substrait_transformation = 9;
UserDefinedFunction user_defined_function = 5 [deprecated = true];
OnDemandSubstraitTransformation on_demand_substrait_transformation = 9 [deprecated = true];
}
// Oneof with {user_defined_function, on_demand_substrait_transformation}
FeatureTransformationV2 feature_transformation = 10;
Expand Down
1 change: 0 additions & 1 deletion protos/feast/core/StreamFeatureView.proto
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ message StreamFeatureViewSpec {
UserDefinedFunction user_defined_function = 13 [deprecated = true];



// Mode of execution
string mode = 14;

Expand Down
33 changes: 12 additions & 21 deletions sdk/python/feast/diff/registry_diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,32 +145,23 @@ def diff_registry_objects(
if _field.name in FIELDS_TO_IGNORE:
continue
elif getattr(current_spec, _field.name) != getattr(new_spec, _field.name):
if _field.name == "transformation":
# TODO: Delete "transformation" after we've safely deprecated it from the proto
if _field.name in ["transformation", "feature_transformation"]:
warnings.warn(
"transformation will be deprecated in the future please use feature_transformation instead.",
Comment thread
franciscojavierarceo marked this conversation as resolved.
Outdated
DeprecationWarning,
)
current_spec = cast(OnDemandFeatureViewSpec, current_spec)
new_spec = cast(OnDemandFeatureViewSpec, new_spec)
current_udf = (
# Check if the old proto is populated and use that if it is
deprecated_udf = current_spec.user_defined_function
feature_transformation_udf = (
current_spec.feature_transformation.user_defined_function
)
new_udf = new_spec.feature_transformation.user_defined_function
for _udf_field in current_udf.DESCRIPTOR.fields:
if _udf_field.name == "body":
continue
if getattr(current_udf, _udf_field.name) != getattr(
new_udf, _udf_field.name
):
transition = TransitionType.UPDATE
property_diffs.append(
PropertyDiff(
_field.name + "." + _udf_field.name,
getattr(current_udf, _udf_field.name),
getattr(new_udf, _udf_field.name),
)
)
elif _field.name == "feature_transformation":
current_spec = cast(OnDemandFeatureViewSpec, current_spec)
new_spec = cast(OnDemandFeatureViewSpec, new_spec)
current_udf = (
current_spec.feature_transformation.user_defined_function
deprecated_udf
if deprecated_udf.body_text != ""
else feature_transformation_udf
)
new_udf = new_spec.feature_transformation.user_defined_function
for _udf_field in current_udf.DESCRIPTOR.fields:
Expand Down
7 changes: 7 additions & 0 deletions sdk/python/feast/infra/registry/base_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,13 @@ def to_dict(self, project: str) -> Dict[str, List[Any]]:
key=lambda on_demand_feature_view: on_demand_feature_view.name,
):
odfv_dict = self._message_to_sorted_dict(on_demand_feature_view.to_proto())
# We are logging a warning because the registry object may be read from a proto that is not updated
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This to_dict method really annoys me, always complicates proto changes 😄 Do we actually need it anywhere? Let me look through the project to see if it's being used. Why can't we just convert the whole proto message to json and be done with it?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For services that are python backed, they will likely use it. We do at Affirm.

# i.e., we have to submit dual writes but in order to ensure the read behavior succeeds we have to load
# both objects to compare any changes in the registry
warnings.warn(
"We will be deprecating the usage of spec.userDefinedFunction in a future release please upgrade cautiously.",
DeprecationWarning,
)
odfv_dict["spec"]["featureTransformation"]["userDefinedFunction"][
"body"
] = on_demand_feature_view.feature_transformation.udf_string
Expand Down
62 changes: 0 additions & 62 deletions sdk/python/tests/unit/test_on_demand_feature_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,65 +133,3 @@ def test_hash():
on_demand_feature_view_5.feature_transformation
== on_demand_feature_view_5.transformation
)


@pytest.mark.filterwarnings("ignore:udf and udf_string parameters are deprecated")
def test_from_proto_backwards_compatable_udf():
file_source = FileSource(name="my-file-source", path="test.parquet")
feature_view = FeatureView(
name="my-feature-view",
entities=[],
schema=[
Field(name="feature1", dtype=Float32),
Field(name="feature2", dtype=Float32),
],
source=file_source,
)
sources = [feature_view]
on_demand_feature_view = OnDemandFeatureView(
name="my-on-demand-feature-view",
sources=sources,
schema=[
Field(name="output1", dtype=Float32),
Field(name="output2", dtype=Float32),
],
transformation=OnDemandPandasTransformation(
udf=udf1, udf_string="udf1 source code"
),
)

# We need a proto with the "udf1 source code" in the user_defined_function.body_text
# and to populate it in feature_transformation
proto = on_demand_feature_view.to_proto()
assert (
on_demand_feature_view.transformation.udf_string
== proto.spec.feature_transformation.user_defined_function.body_text
)
# Because of the current set of code this is just confirming it is empty
assert proto.spec.user_defined_function.body_text == ""
assert proto.spec.user_defined_function.body == b""
assert proto.spec.user_defined_function.name == ""

# Assuming we pull it from the registry we set it to the feature_transformation proto values
proto.spec.user_defined_function.name = (
proto.spec.feature_transformation.user_defined_function.name
)
proto.spec.user_defined_function.body = (
proto.spec.feature_transformation.user_defined_function.body
)
proto.spec.user_defined_function.body_text = (
proto.spec.feature_transformation.user_defined_function.body_text
)

# And now we're going to null the feature_transformation proto object before reserializing the entire proto
# proto.spec.user_defined_function.body_text = on_demand_feature_view.transformation.udf_string
proto.spec.feature_transformation.user_defined_function.name = ""
proto.spec.feature_transformation.user_defined_function.body = b""
proto.spec.feature_transformation.user_defined_function.body_text = ""

# And now we expect the to get the same object back under feature_transformation
reserialized_proto = OnDemandFeatureView.from_proto(proto)
assert (
reserialized_proto.feature_transformation.udf_string
== on_demand_feature_view.feature_transformation.udf_string
)