Title: fix: Include vector attributes in Field equality by haoxu0 · Pull Request #6934 · feast-dev/feast · GitHub
Open Graph Title: fix: Include vector attributes in Field equality by haoxu0 · Pull Request #6934 · feast-dev/feast
X Title: fix: Include vector attributes in Field equality by haoxu0 · Pull Request #6934 · feast-dev/feast
Description: Addresses item 5 of #6907: Field.__eq__ ignores vector_index and vector_search_metric, so a change that alters retrieval semantics produces no diff in feast plan / apply. Why they were disabled, and why that reason is now gone I traced this before changing it. Commit 1035cd4ab from #4855: "Have to remove the equality test for the new fields...for now we're going to ignore them so it is backwards compatible" That was the right call at the time. The same commit also switched from_proto from HasField checks to getattr(field_proto, 'vector_search_metric', ''), which introduced an asymmetry: Field(name="x", dtype=String).vector_search_metric # None Field.from_proto(that.to_proto()).vector_search_metric # '' With the comparison enabled, every field lacking an explicit metric would compare unequal to its own deserialized copy — so every feast plan would report spurious changes. Commenting out the comparison was the cheap way to stop that. This PR fixes the asymmetry instead, which removes the reason for the exclusion. The normalization belongs in __init__, not from_proto My first attempt normalized from_proto. That was the wrong layer, and the test suite caught it: two tests in test_on_demand_pandas_transformation.py started failing with ValueError: The projection for scaled cannot be applied because it contains conv_rate_x10 which the FeatureView doesn't have. BaseFeatureView.with_projection checks feature not in self.features, which is this same __eq__. Instrumenting the comparison showed the two sides disagreeing on exactly one attribute: proj field: name='conv_rate_x10' idx=False len=0 metric=None <- via Field.from_proto fv field: name='conv_rate_x10' idx=False len=0 metric='' <- via another path from_proto is not the only deserialization path — OnDemandFeatureView._parse_features_from_proto builds a Field directly from a proto message and never calls it. Normalizing in __init__ makes every construction path converge, including any added later: self.vector_search_metric = vector_search_metric or None After that, both paths agree and the projection applies again. Effect COSINE vs L2 equal=False (was: silently equal) vector_index toggled equal=False (was: silently equal) round-trip equal True (backwards compatibility preserved) Testing Added to test_eq_cross_type.py, which is already the module for equality semantics: test_field_eq_includes_vector_attributes — metric change and vector_index toggle are detected test_field_survives_a_proto_round_trip — parametrized over plain / vector-without-metric / vector-with-metric; this is the backwards-compatibility guard, so it should keep passing forever test_field_normalizes_an_empty_metric_to_none — pins the __init__-level normalization, and documents why that layer rather than from_proto The first and third fail against master and pass here. 26 passed in that module. For regressions I diffed failure names across the whole unit suite rather than comparing counts, since the suite has flaky members: with this change : 41 failures master : 41 failures only with change : (none) ruff check clean, mypy feast/field.py clean. Note on item 3 of #6907 Item 3 proposed requiring vector_length when vector_index=True. I looked into it and that specific change is not viable: there are ~29 call sites declaring vector_index=True without vector_length, including Feast's own feast init -t rag and -t ray_rag templates, several examples/, and four online stores that deliberately fall back to 512. Making it mandatory would break the onboarding path. I'll follow up separately with a non-breaking alternative — rather than skipping validation when vector_length is unset, enforce internal consistency against the first row's width, which catches ragged vectors without requiring anyone to declare anything.
Open Graph Description: Addresses item 5 of #6907: Field.__eq__ ignores vector_index and vector_search_metric, so a change that alters retrieval semantics produces no diff in feast plan / apply. Why they were disabled, an...
X Description: Addresses item 5 of #6907: Field.__eq__ ignores vector_index and vector_search_metric, so a change that alters retrieval semantics produces no diff in feast plan / apply. Why they were disabled, an...
Opengraph URL: https://github.com/feast-dev/feast/pull/6934
X: @github
Domain: github.com
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:30210902-8e58-67ca-1918-e903ccc2409e |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9CF8:DDED5:F72D09:1526B5E:6AFE9892 |
| html-safe-nonce | 23e05a2096d97109f32016b1512c8195736a90a48450ba0c42aadce7a76e47d8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5Q0Y4OkRERUQ1OkY3MkQwOToxNTI2QjVFOjZBRkU5ODkyIiwidmlzaXRvcl9pZCI6Ijg0MTExNTQ3Mjg5NjgxNjU1MjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | df85627fcdb8a27d0730c1d74387e855f8c7cccbb370385ab185ff2846de831d |
| hovercard-subject-tag | pull_request:4722982583 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/feast-dev/feast/pull/6934/files |
| twitter:image | https://avatars.githubusercontent.com/u/20422210?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/20422210?s=400&v=4 |
| og:image:alt | Addresses item 5 of #6907: Field.__eq__ ignores vector_index and vector_search_metric, so a change that alters retrieval semantics produces no diff in feast plan / apply. Why they were disabled, an... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/feast-dev/feast git https://github.com/feast-dev/feast.git |
| octolytics-dimension-user_id | 57027613 |
| octolytics-dimension-user_login | feast-dev |
| octolytics-dimension-repository_id | 161133770 |
| octolytics-dimension-repository_nwo | feast-dev/feast |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 161133770 |
| octolytics-dimension-repository_network_root_nwo | feast-dev/feast |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width