← 输入框|github.com|刷新
Skip to content

fix: Stop feast plan and apply raising on a changed BatchFeatureView - #7042

Open
spicysharkco wants to merge 1 commit into
feast-dev:masterfrom
spicysharkco:fix/diff-batch-feature-view-transformation
Open

spicysharkco wants to merge 1 commit into
feast-dev:masterfrom
spicysharkco:fix/diff-batch-feature-view-transformation

Conversation

@spicysharkco

Copy link
Copy Markdown

What this PR does / why we need it:

feast plan raises for a @batch_feature_view with a transformation as soon as anything in it differs from the registry. feast apply raises too: with the default local provider and SQLite online store it runs the same plan first. To reproduce, apply such a repo with tags={"team": "a"}, change the tag to "b" and run feast plan:

ValueError: Protocol message FeatureViewSpec has no "user_defined_function" field.

With this change feast plan prints the diff and feast apply goes through.

Cause: diff_registry_objects calls HasField("user_defined_function") on every spec whose feature_transformation changed. That deprecated field exists on OnDemandFeatureViewSpec and StreamFeatureViewSpec, not on FeatureViewSpec. A view read back from the registry never carries the declared transformation bytes, so any change to the view reaches this branch.

The fix reads the field only when the spec has it (hasattr, as on_demand_feature_view.py does). On demand views behave as before. Not covered here: a change to only the function body of a batch view is still not detected, because the view's __eq__ ignores the transformation.

Which issue(s) this PR fixes:

No issue, found while checking feast plan diffs.

Checks

  • I've made sure the tests are passing.
  • My commits are signed off (git commit -s)
  • My PR title follows conventional commits format

Testing Strategy

  • Unit tests
  • Integration tests

Added test_diff_batch_feature_view_with_transformation next to test_diff_odfv in sdk/python/tests/unit/diff/test_registry_diff.py. It diffs a view read back from its proto against a changed declaration: a tags change reports only tags, and a tags plus function text change reports tags and feature_transformation.body_text. It fails on master with the ValueError above and passes with the fix: pytest sdk/python/tests/unit/diff/test_registry_diff.py -k test_diff_batch_feature_view_with_transformation gives 1 passed, the whole file 6 passed. ruff check and ruff format --check are clean on both files.

diff_registry_objects treated every changed feature_transformation as
belonging to an on demand feature view and read the deprecated top-level
user_defined_function field of the spec. FeatureViewSpec has no such
field, so feast plan raised ValueError for a BatchFeatureView with a
transformation as soon as anything in it differed from the registry.
feast apply raised the same way when it ran the plan first (local
provider, SQLite online store). Read the deprecated field only when the
spec has it.

Signed-off-by: spicysharkco <321699413+spicysharkco@users.noreply.github.com>
@spicysharkco
spicysharkco requested a review from a team as a code owner October 19, 2026 06:17

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants