fix: Use a shared entity_rows name as both request data and join key - #6794
Open
OHMFOHS wants to merge 1 commit into
Open
fix: Use a shared entity_rows name as both request data and join key#6794OHMFOHS wants to merge 1 commit into
OHMFOHS wants to merge 1 commit into
Conversation
_prepare_entities_to_read_from_online_store classified each entity_rows
key with a mutually-exclusive if/elif chain, so a name that appears in
needed_request_data was only ever treated as request data. When an
OnDemandFeatureView's RequestSource declares a field whose name matches a
FeatureView's join key, the join key branch was unreachable and every
FeatureView expecting that join key failed with a missing-join-key error,
even though the value was present in entity_rows.
get_historical_features accepts the equivalent entity_df, so the same
input succeeded offline and failed online.
Classify the request-data and join-key roles independently. Building the
response also had to move from dict(**a, **b) to {**a, **b}: the former
raises TypeError when the same name is present in both mappings, which is
exactly the case this change makes reachable.
Adds five regression tests covering the shared name resolving as a join
key, appearing in the result row names, being emitted only once in the
response, and the two unchanged control cases.
Closes feast-dev#6790
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: Junchao Mao <925160568@qq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Closes #6790.
_prepare_entities_to_read_from_online_storeclassified eachentity_rowskey with a mutually-exclusiveif/elifchain:A name present in
needed_request_datawas therefore only ever treated as request data. When anOnDemandFeatureView'sRequestSourcedeclares a field whose name matches aFeatureView's join key, the join-key branch is unreachable,join_key_valuesnever receives the value, and everyFeatureViewexpecting that join key fails with a missing-join-key error — even though the value was present inentity_rowsall along.get_historical_featuresaccepts the equivalententity_df, so the same input succeeds offline and fails online.This PR classifies the two roles independently.
A second issue this surfaces
Making that name reachable in both mappings exposes a latent failure one line later:
dict(**a, **b)raisesTypeError: got multiple values for keyword argumentwhen the same key is in both mappings — exactly the case this change makes possible. Switched to the dict literal{**a, **b}, which permits the duplicate. Both mappings hold the samevaluesobject for a shared name, so the merge is unambiguous.test_shared_name_populates_response_onceguards against the name being emitted twice.Tests
Adds
sdk/python/tests/unit/test_shared_request_data_join_key.py(5 cases), following the existingtest_feature_resolution_cache.pypattern of patching_get_online_request_context:join_key_values(control)Two of these fail on
master(assert 'user_id' in {}—join_key_valuesis empty) and all five pass with this change.Verification
Full
sdk/python/tests/unitrun, same environment, before and after:masterThe failure sets are identical in both directions — the 94 pre-existing failures are unrelated collection/dependency errors in my local environment (missing optional extras such as
httpx2,boto3,pymilvus), and the +5 is exactly the new tests.ruff check,ruff format --check, andmypy feast/utils.pyare all clean on the changed files.