Repository navigation
fix: Return on demand features with full feature names and over Python gRPC - #7236
Open
patelchaitany wants to merge 4 commits into
Open
patelchaitany wants to merge 4 commits into
patelchaitany wants to merge 4 commits into
Conversation
…sted With full_feature_names=True, online retrieval asks for an on demand feature as "<view>__<feature>". Pandas mode renames the UDF's outputs to that form in transform_arrow, but transform_dict, used by Python mode, returned them under their bare names, so none matched the request and the features were dropped from the response without an error. Give transform_dict the same full_feature_names argument and output renaming as transform_arrow, and pass it from online retrieval. Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
get_online_features takes entity values as proto Values, which is how the Python gRPC feature server passes a request's RepeatedValue map. Join keys convert because their type is known and proto Values pass through, but request data for an on demand feature view has no declared type, and inferring one from a proto Value raised "Value with native type value cannot be converted into Feast value type". Every gRPC request for an on demand feature view with a request source failed. When the type is unknown and the values are already proto Values, take the type from the field the proto sets and pass the values through. Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
Contributor
There was a problem hiding this comment.
Devin Review found 2 potential issues.
3 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7236 +/- ##
=======================================
Coverage 54.10% 54.11%
=======================================
Files 467 467
Lines 58940 58949 +9
Branches 8688 8692 +4
=======================================
+ Hits 31890 31899 +9
+ Misses 24892 24889 -3
- Partials 2158 2161 +3
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
With full_feature_names=True, online retrieval selects an on demand feature by its "<view>__<feature>" name, but looked up its declared type by the bare name. The lookup missed, so the values were converted with an inferred type: a batch of empty arrays raised "Couldn't infer value type from empty value", and Python floats in an Array(Float32) came back as a double list. Key the type lookup by the same name used to select the output. Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
Replace the three tests with one: a Python-mode view with an Array(Float32) output, read with full feature names, with its request data passed as a proto Value, returning an empty list. It fails without any one of the three fixes. Signed-off-by: Chaitany Patel <patelchaitany93@gmail.com>
franciscojavierarceo
approved these changes
Nov 25, 2026
This branch has not been deployed
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 / why we need it:
Two bugs in online retrieval for on demand feature views. Each fix is its own commit, plus a third that keeps declared types with full feature names.
1. Python-mode features are dropped with
full_feature_names=TrueA Python-mode on demand feature view returns none of its features when
full_feature_names=True. They are dropped from the response, with no error.Why. Online retrieval asks for an on demand feature as
<view>__<feature>. Pandas mode renames the UDF's outputs to that form intransform_arrow. Python mode usestransform_dict, which kept the bare names (greeting), so nothing matched the request.Fix.
transform_dictnow takes the samefull_feature_namesargument and renames outputs the waytransform_arrowdoes. Online retrieval (_augment_response_with_on_demand_transformsinutils.py), its only caller, passes the flag through. Python mode now returnsgreeting_view__greeting, the same as pandas mode. With the flag off, nothing changes.Declared types. Online retrieval selected an output by its long name but looked up its declared type by the bare name. The lookup missed, so the values were converted with an inferred type: a batch of empty arrays raised
Couldn't infer value type from empty value, and Python floats in anArray(Float32)came back as a double list. The type lookup in_augment_response_with_on_demand_transformsnow uses the same name as the output selection.2. The Python gRPC server fails for views with request fields
Every request to the Python gRPC feature server fails for an on demand feature view that reads a request source:
Why. The gRPC server passes a request's entities to
get_online_featuresas protoValues, whichget_online_featuresaccepts. Join keys work because their type is known, and protoValues pass straight through. Request fields have no declared type, so Feast infers one from the first value, andpython_type_to_feast_value_typecannot infer a type from a protoValue.Fix. In
python_values_to_proto_values(type_map.py), when the type is unknown and the values are already protoValues, take the type from the field the proto sets. The values then pass through unchanged. This also fixes SDK callers who passRepeatedValues, not only gRPC.Which issue(s) this PR fixes:
No GitHub issue.
Checks
git commit -s)Testing Strategy
One test,
test_python_view_with_full_feature_namesintests/unit/test_on_demand_python_transformation.py, covers all three fixes. A Python-mode view with anArray(Float32)output is read withfull_feature_names=True, its request data is passed as a protoValue(as the gRPC server does), and it returns an empty list. Without any one of the fixes it fails:KeyErrorwithout the naming fix,Value with native type value cannot be convertedwithout the proto value fix, andCouldn't infer value type from empty valuewithout the type fix.The on demand feature view, type map and feature server unit suites pass. In a wider run,
test_milvus_native_from_feast_datacrashed insidemilvus_lite's faiss index build on my machine, with or without these changes.ruffandmypyare clean.Manually, against a local repo: Python mode returned
greeting_view__greetingwithfull_feature_names=True, matching pandas mode, and a real gRPC call to the Python feature server returnedgreeting: "Hi Alice (s1)"for a view with a request source, in both Python and pandas mode.