Skip to content

Conversation

@astronautas
Copy link
Contributor

@astronautas astronautas commented Dec 17, 2025

What this PR does / why we need it:

Expected Behavior

On-demand feature views (ODFVs) with write_to_online_store=True should be materialized to the online store, but they should never be queried from the offline store (ODFVs, no data for them in the offline store).

Current Behavior

ODFVs with write_to_online_store=True are being queried from offline stores. In the code here
, if an ODFV has the write_to_online_store flag set, it is treated as a regular feature view. As a result, it gets queried from the offline store.

However, ODFVs are not historical feature views and do not have any data in offline stores, so they should never be queried there.

As discussed with @franciscojavierarceo, we remove the special condition to treat these materialized ODFVs and treat them as regular ODFVs, when retrieving offline features.

Which issue(s) this PR fixes:

#5776

Misc

…ical

Signed-off-by: lukas.valatka <lukas.valatka@cast.ai>
@astronautas astronautas requested a review from a team as a code owner December 17, 2025 10:50
@astronautas
Copy link
Contributor Author

@franciscojavierarceo

@astronautas
Copy link
Contributor Author

FAILED sdk/python/tests/unit/test_on_demand_python_transformation.py::TestOnDemandPythonTransformation::test_stored_writes - AssertionError: assert ['counter', '...put_datetime'] == ['conv_rate_p...put_datetime']
At index 0 diff: 'counter' != 'conv_rate_plus_acc'
Right contains 2 more items, first extra item: 'driver_id'
Full diff:
[

  • 'conv_rate_plus_acc',
    'counter',
  • 'current_datetime',
    'driver_id',
    'input_datetime',
    ]
    FAILED sdk/python/tests/unit/online_store/test_online_retrieval.py::test_milvus_stored_writes_with_explode - KeyError: 'Feature document_id not found in projection milvus_explode_feature_view'

lots of unit tests failing. Will need to check :/

@franciscojavierarceo
Copy link
Member

So maybe I misunderstood, but ODFVs should be queryable from offline store. They should either execute the transformation at query time or be precomputed and stored already.

@astronautas
Copy link
Contributor Author

astronautas commented Dec 17, 2025

First, here's what the docs say:

https://docs.feast.dev/reference/beta-on-demand-feature-view

By setting write_to_online_store=True, transformations are applied during data ingestion, and the transformed features are stored in the online store. This can improve online feature retrieval performance by reducing computation during reads. Conversely, if write_to_online_store=False (the default if omitted), transformations are applied during feature retrieval.


Here's my thinking and experience using this new feature in prod. You call store.materialize an an ODFV, and it does get stored in online store (tested this ourselves).

ODFVs are precomputed and stored within the online store if write_to_online_store=True, or computed on request time otherwise. At least that's how their materialization is implemented within Feast code (we tested it in prod!). Offline stores are populated by offline jobs, outside of Feast e.g. Clickhouse, Spark, whatnot, which get_historical_features merely then slices off features from to materialize into online store e.g. materialize from Clickhouse into Redis.

@franciscojavierarceo write_to_online_store flag that enables materializing (precomputing) ODFVs has online, not offline store, within its semantical definition as well.


Lastly:

the logic I propose to change in the PR above within get_historical_features from an offline store:

elif view.projection and view.write_to_online_store:

has nothing to do with offline stores, but rather with online stores - it seems flawed to call it in offline_store.get_historical_features

sorry long text, but got to explain :D The test is missing materialize step, which loads ODFV values into online store, to be queried (think, cached).


Here's the gist. Hope it makes sense.

@astronautas
Copy link
Contributor Author

@franciscojavierarceo

woop and others added 7 commits December 17, 2025 19:52
Removed Cast.ai logo from the homepage.
Signed-off-by: lukas.valatka <lukas.valatka@cast.ai>
Signed-off-by: lukas.valatka <lukas.valatka@cast.ai>
Signed-off-by: lukas.valatka <lukas.valatka@cast.ai>
Signed-off-by: lukas.valatka <lukas.valatka@cast.ai>
…atures' of github.com:astronautas/feast into fix/materialized-odfv-not-working-for-get-historical-features
…nto fix/materialized-odfv-not-working-for-get-historical-features
# on demand view to on demand view proto
on_demand_view_index: Dict[str, "OnDemandFeatureView"] = {}
for view in all_on_demand_feature_views:
if view.projection and not view.write_to_online_store:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need projections IIRC in the materialization

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so if you want to avoid the transformation on get_historical_features then i would put that logic there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I'll check and adjust.

Signed-off-by: lukas.valatka <lukas.valatka@cast.ai>
@astronautas
Copy link
Contributor Author

@franciscojavierarceo Closing PR. Will open up a related fix only targeting get_historical_features, need to re-think this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants