Skip to content

fix: Stop the Ray engine from hiding materialization errors - #7026

Merged
ntkathole merged 3 commits into
feast-dev:masterfrom
patelchaitany:fix/ray-materialization-errors
Oct 18, 2026
Merged

ntkathole merged 3 commits into
feast-dev:masterfrom
patelchaitany:fix/ray-materialization-errors

Conversation

@patelchaitany

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The Ray compute engine hid errors during materialization. A job could report SUCCEEDED even when nothing was written to the online store. Fixing that showed two more bugs that the hidden errors were covering up. This PR fixes all three, one commit each.

1. A failed online write was reported as success (#7024)
When the online store refused a write, Ray logged the error and still reported SUCCEEDED, so users kept getting old values. Now the error is raised again after it is logged, and the write step is no longer wrapped in safe_batch_processor. A failed write now fails the job, the same as with the Local engine.

2. An aggregated BatchFeatureView could never be written to the online store
The Ray aggregation step dropped the event timestamp and created timestamp columns. The online write needs them, so it always failed (bug 1 hid this). Now the aggregation keeps the latest event and created timestamp for each entity.

3. The UDF ran at a different point in each Ray path
Materialization ran the UDF on raw rows before aggregation, but historical retrieval ran it after aggregation. So a UDF could only work in one path. In the other path its error was hidden by safe_batch_processor, and users got values that were never transformed. Now historical retrieval also runs the UDF before aggregation. This matches the compute engine docs and the Local and Spark engines. The transformation step no longer hides UDF errors.

Behavior changes to note

  • A materialization that has been failing quietly will now report ERROR.
  • On Ray, a UDF on an aggregated BatchFeatureView that used aggregated column names (for example sum_conv_rate) must now use the raw column names (for example conv_rate).

safe_batch_processor itself is unchanged; other nodes still use it.

Which issue(s) this PR fixes:

Fixes #7024

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

Tests in sdk/python/tests/component/ray:

  • New test_ray_write_node_raises_when_online_write_fails: fails on master, passes with this PR.
  • test_ray_compute_engine_materialize: now uses the aggregated feature names in the schema, and reads the values back from the SQLite online store. Its UDF was removed, because on master it never actually ran (its error was hidden).
  • test_ray_compute_engine_get_historical_features: the UDF now uses the raw columns. Expected values are unchanged. Fails on master, passes with this PR.

Ray component tests: 76 passed (non-integration), 14 passed (--integration).

Misc

@patelchaitany
patelchaitany requested a review from a team as a code owner October 16, 2026 11:13
@codecov-commenter

codecov-commenter commented Oct 16, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 15 lines in your changes missing coverage. Please review.
✅ Project coverage is 50.98%. Comparing base (68c5d54) to head (f446423).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...dk/python/feast/infra/compute_engines/ray/nodes.py 0.00% 11 Missing ⚠️
...feast/infra/compute_engines/ray/feature_builder.py 0.00% 2 Missing ⚠️
...dk/python/feast/infra/compute_engines/ray/utils.py 0.00% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7026      +/-   ##
==========================================
- Coverage   50.99%   50.98%   -0.01%     
==========================================
  Files         455      455              
  Lines       56979    56990      +11     
  Branches     8315     8320       +5     
==========================================
  Hits        29059    29059              
- Misses      25935    25946      +11     
  Partials     1985     1985              
Flag Coverage Δ
go-feature-server 30.58% <ø> (ø)
python-unit 52.45% <0.00%> (-0.02%) ⬇️
Files with missing lines Coverage Δ
...feast/infra/compute_engines/ray/feature_builder.py 0.00% <0.00%> (ø)
...dk/python/feast/infra/compute_engines/ray/utils.py 0.00% <0.00%> (ø)
...dk/python/feast/infra/compute_engines/ray/nodes.py 0.00% <0.00%> (ø)

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 68c5d54...f446423. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

last_node = self.build_source_node(self.feature_view)

# 2. Apply filters (TTL, custom filters) BEFORE aggregation
# 2. Apply transformations to the raw source data, as materialization does

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this order change matching other compute engines?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes. Local, Spark and Flink all run the UDF before aggregation (shared FeatureBuilder._build). Only Ray historical retrieval ran it after, and this fixes that.

@patelchaitany
patelchaitany force-pushed the fix/ray-materialization-errors branch from e3483a6 to 5feefae Compare October 17, 2026 14:27
@patelchaitany
patelchaitany requested a review from haoxu0 October 17, 2026 14:47
# Not wrapped in safe_batch_processor: a failed write must fail the job.
def write_batch_with_serialized_artifacts(batch: pd.DataFrame) -> pd.DataFrame:
"""Write each batch using pre-serialized artifacts."""
if batch.empty:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

for consistency over other code if _is_empty_batch(batch):


# Combine aggregation results
if agg_results:
# Keep the latest timestamps per group; the online write needs them.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tiled aggregation doesn’t preserve created_timestamp_col (fix only touched the standard _fallback_pandas_aggregation).

@patelchaitany
patelchaitany force-pushed the fix/ray-materialization-errors branch 2 times, most recently from 988a73f to f7e40d2 Compare October 18, 2026 13:56
When the online store refused a write, the Ray engine only logged the
error and still reported the job as SUCCEEDED. Users kept getting old
feature values and had no sign that anything went wrong.

Now the error is raised again after it is logged, and the write step is
no longer wrapped in safe_batch_processor, which hid every error. A
failed write now fails the job, the same as with the Local engine.

Fixes feast-dev#7024

Signed-off-by: Chaitany Patel <[email protected]>
The Ray aggregation step kept only the entity keys and the aggregated
values. It dropped the event timestamp and created timestamp columns.
The online store write needs these columns, so writing an aggregated
BatchFeatureView to the online store always failed. The previous commit
made this failure visible.

Now the aggregation keeps the latest event timestamp and created
timestamp for each entity.

Signed-off-by: Chaitany Patel <[email protected]>
In materialization, the Ray engine ran the UDF on raw rows before
aggregation. In historical retrieval, it ran the UDF after aggregation.
So a UDF could only work in one of the two paths. In the other path it
raised an error, and safe_batch_processor hid that error, so users got
values that were never transformed.

Now historical retrieval also runs the UDF on raw rows before
aggregation. This matches the compute engine docs and the Local and
Spark engines. The transformation step is no longer wrapped in
safe_batch_processor, so a UDF error now fails the job.

A UDF that used aggregated column names (for example sum_conv_rate)
must now use the raw column names (for example conv_rate).

Signed-off-by: Chaitany Patel <[email protected]>
@ntkathole
ntkathole force-pushed the fix/ray-materialization-errors branch from f7e40d2 to f446423 Compare October 18, 2026 14:31
@ntkathole
ntkathole merged commit 7903e2e into feast-dev:master Oct 18, 2026
24 of 25 checks passed
@ericdelorefice

Copy link
Copy Markdown
Contributor

Thanks @patelchaitany for picking this up so quickly, and for fixing the aggregation and UDF problems it was hiding. And thanks @ntkathole for the review and merge.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ray compute engine reports a failed online-store write as a successful materialization

5 participants