fix: Keep the Arrow type of an all-missing feature in OnlineResponse.to_arrow #7249
All Vouch review confidence checks passed
Residual risk 0.27 = Change Risk (0.50) × (1 − Review Confidence (0.47)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 619 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.385
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #7249"
general
weight: 0.35
mansur-akhmadi
What this PR does / why we need it:
OnlineResponse.to_arrow()infers column types from the returned values, so a feature that is missing for every requested entity (or a zero-row request) came back as an Arrownullcolumn, while the same feature with any value present isint64/double/string/... The schema of a serving batch depended on its data.When every value of a column is missing and the feature's value type is known (
feature_types, whichOnlineStore.get_online_featuresalready passes), the column is now built withpa.nulls(n, type=...), using the type thatto_arrow()infers for that value type when values are present (Int32/Int64->int64,Float32/Float64->double,String/UUIDs ->string,Bytes/PdfBytes/ImageBytes->binary,Bool,UnixTimestamp->timestamp[us, tz=UTC], and the list types likewise, includingArray(UnixTimestamp)->list<timestamp[us, tz=UTC]>). Columns with at least one value go throughfrom_pydictexactly as before, so existing schemas do not change.Left as is:
Map,Struct,Json,Decimal, sets, nested lists) keepnullwhen all values are missing.OnlineResponse._to_arrow(), same as before this PR): pandas turns a typed all-null column intoNaN/NaT, so a UDF that checks forNonewould change behavior, and a passed-throughNaTwould become aunix_timestamp_valof int64 min.feature_types(only feature view features are), so an all-missing ODFV output is stillnull.An on demand output that reuses the short name of one of its stored inputs replaces that column in the response, so the final
OnlineResponseno longer carries the input's type hint for that name (_augment_response_with_on_demand_transformsreturns the output names; bothget_online_featurespaths drop them fromfeature_typesafter the transformations ran, which still see the input hints). Without this, an all-missing string output named like its integer input becameint64.Which issue(s) this PR fixes:
Fixes #7248
Checks
git commit -s)Testing Strategy
Misc
How it was verified:
pytest sdk/python/tests/unit/test_online_response.py: the new tests fail on master (22 failed: every mapped value type givesnull, also with afv__featurename and with zero rows) and pass with the change (27 passed). Each mapped type is checked against the typeto_arrow()produces for the same feature with a value present, and a test keeps the cases in sync with the map; also covered: a partially missing column is unchanged, an unknown type staysnull.test_on_demand_pandas_transformation.py::test_pandas_odfv_sees_none_for_feature_missing_for_every_entity: a pandas UDF still getsNonefor a feature no requested entity has, whileto_arrow()of the same response types that columnint64; fails if the on demand path reads the typed table.feast initdemo repo with the SQLite online store:to_arrow()for an entity that is not materialized now givesavg_daily_trips: int64, conv_rate: double, same as for a materialized one.pytest -n 8overtest_online_response.py,test_unit_feature_store.py,online_store/, the ODFV pandas/python transformation tests,test_feature_server.py,test_precomputed_feature_vectors.py,local_feast_tests/: 243 passed; 3 failures are environment-only and fail the same on master (no Java for the Spark stream feature view tests, Milvus Lite worker crash on macOS).test_online_response.py, the ODFV pandas/aggregation/input-schema/feature view tests andtest_utils.py: 96 passed, 4 skipped (the twoto_tensortests need torch, not installed here).test_odfv_output_reusing_a_source_feature_name_does_not_take_its_typegivesint64for the all-missing string output without the change andnullwith it (stringwhen a value is present). Fullpytest -n 8 sdk/python/tests/unitwith the CI requirements: 4528 passed; 5 failures are the Spark stream feature view tests (no Java here).ruff check,ruff format --check,mypy feast: clean.<!-- devin-review-badge-begin -->
---
<a href="https://app.devin.ai/review/feast-dev/feast/pull/7249" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->