← Back to Pull requests

fix: Keep the Arrow type of an all-missing feature in OnlineResponse.to_arrow #7249

Open
unknown opened this pull request with 619 lines diff across 7 files
View on GitHub
unknown unknown commented on Nov 26, 2026 17:10 UTC
Author

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 Arrow null column, while the same feature with any value present is int64/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, which OnlineStore.get_online_features already passes), the column is now built with pa.nulls(n, type=...), using the type that to_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, including Array(UnixTimestamp) -> list<timestamp[us, tz=UTC]>). Columns with at least one value go through from_pydict exactly as before, so existing schemas do not change.

Left as is:

  • Value types whose inferred Arrow type depends on the data (Map, Struct, Json, Decimal, sets, nested lists) keep null when all values are missing.

  • On demand transformations keep reading the untyped table (OnlineResponse._to_arrow(), same as before this PR): pandas turns a typed all-null column into NaN/NaT, so a UDF that checks for None would change behavior, and a passed-through NaT would become a unix_timestamp_val of int64 min.

  • On demand feature view outputs are not in feature_types (only feature view features are), so an all-missing ODFV output is still null.
  • An on demand output that reuses the short name of one of its stored inputs replaces that column in the response, so the final OnlineResponse no longer carries the input's type hint for that name (_augment_response_with_on_demand_transforms returns the output names; both get_online_features paths drop them from feature_types after the transformations ran, which still see the input hints). Without this, an all-missing string output named like its integer input became int64.

    Which issue(s) this PR fixes:

    Fixes #7248

    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

  • Manual tests

  • Testing is not required for this change
  • 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 gives null, also with a fv__feature name and with zero rows) and pass with the change (27 passed). Each mapped type is checked against the type to_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 stays null.

  • test_on_demand_pandas_transformation.py::test_pandas_odfv_sees_none_for_feature_missing_for_every_entity: a pandas UDF still gets None for a feature no requested entity has, while to_arrow() of the same response types that column int64; fails if the on demand path reads the typed table.

  • feast init demo repo with the SQLite online store: to_arrow() for an entity that is not materialized now gives avg_daily_trips: int64, conv_rate: double, same as for a materialized one.

  • pytest -n 8 over test_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).

  • After the review round: test_online_response.py, the ODFV pandas/aggregation/input-schema/feature view tests and test_utils.py: 96 passed, 4 skipped (the two to_tensor tests need torch, not installed here).

  • Second review round (output reusing an input's name): test_odfv_output_reusing_a_source_feature_name_does_not_take_its_type gives int64 for the all-missing string output without the change and null with it (string when a value is present). Full pytest -n 8 sdk/python/tests/unit with 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 -->

    Diff: 619 lines (+464 / -155) across 7 files Reviewer: mansur-akhmadi Review duration: 7432m
    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
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50.2% (MEDIUM) · Higher = larger blast radius
    50.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 26.8% · Safe to merge
    26.8%