Skip to content

fix: Bind per-feature-view values in the Ray offline store closures - #7175

Merged
ntkathole merged 1 commit into
feast-dev:masterfrom
VenishPaneliya:fix-ray-closure-late-binding
Nov 18, 2026
Merged

ntkathole merged 1 commit into
feast-dev:masterfrom
VenishPaneliya:fix-ray-closure-late-binding

Conversation

@VenishPaneliya

@VenishPaneliya VenishPaneliya commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What this does

Two closures inside RayOfflineStore.get_historical_features are defined in the
for fv in regular_feature_views: loop but read their per-iteration values from the
enclosing scope. Dataset.map_batches is lazy, so the functions do not run until the
dataset is consumed — after the loop has finished and those names hold the last
feature view's values.

  • apply_transformation_with_serialized_func reads transformation_serialized
    and fv.name.
  • add_timestamp_field reads timestamp_field, which the field-mapping block just
    above reassigns per feature view.

With two or more transformed feature views in one retrieval, every one of them gets
the last view's UDF applied. The fix binds the values as parameter defaults at
definition time; the non-transformed path is untouched.

Expected behaviour & risk

Before, with feature views driver_hourly_stats (udf A) and customer_profile
(udf B), consuming the first dataset applies udf B:

driver_hourly_stats    -> rows |udf-for-B|customer_profile
customer_profile       -> rows |udf-for-B|customer_profile

After, each view gets its own:

driver_hourly_stats    -> rows |udf-for-A|driver_hourly_stats
customer_profile       -> rows |udf-for-B|customer_profile

No signature or behaviour change for a single feature view, which is why the existing
tests pass either way.

How this was tested

I reproduced the loop and a lazy map_batches stand-in to get the output above, and
checked statically that both closures now bind their values as defaults. ruff check
and ruff format --check pass on the file under the repo's config (the file was
format-clean before and still is). ruff also no longer reports B023
(function-uses-loop-variable) for either closure.

I did not add a unit test: both closures are defined inline inside a ~400-line method,
so reaching them needs a live Ray cluster and a materialised feature repo rather than
a unit test. If you would prefer them lifted into module-level factories so they can
be tested directly, I am happy to do that in this PR.


Devin Review

@VenishPaneliya
VenishPaneliya requested a review from a team as a code owner November 17, 2026 18:06

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Devin Review

Comment on lines +2450 to +2451
transformation_serialized: bytes = transformation_serialized,
fv_name: str = fv.name,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Missing required multi-view regression tests

The get_historical_features changes include no unit or retrieval regression tests. The component checklist requires both for retrieval changes.

Learn more

The component checklist requires unit coverage for component changes and a universal test when retrieval behavior changes. This PR changes both transformation selection and timestamp-column creation during multi-view historical retrieval, but its diff contains no test additions or updates. A deferred-callback unit test can capture the functions passed to map_batches and invoke them after both feature views have been processed.

Example: Use two feature views with distinct transformations and timestamp names, such as driver_time and customer_time. After constructing both callbacks, invoke each with its matching batch and verify that each transformation and timestamp column belongs to the correct view. Also exercise transformation failure to check the captured view name.

Recommended fix: Add unit coverage under sdk/python/tests/unit/infra/ using mocked dataset and store dependencies. Add a retrieval regression test that requests two views and consumes the result. Verify that the tests fail when the corresponding default bindings are removed.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

@codecov-commenter

codecov-commenter commented Nov 17, 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 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.23%. Comparing base (f4fb537) to head (c7add8a).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
...ra/offline_stores/contrib/ray_offline_store/ray.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    #7175   +/-   ##
=======================================
  Coverage   53.23%   53.23%           
=======================================
  Files         459      459           
  Lines       58427    58427           
  Branches     8629     8629           
=======================================
  Hits        31103    31103           
  Misses      25208    25208           
  Partials     2116     2116           
Flag Coverage Δ
go-feature-server 30.96% <ø> (ø)
python-unit 54.79% <0.00%> (ø)
Files with missing lines Coverage Δ
...ra/offline_stores/contrib/ray_offline_store/ray.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 f4fb537...c7add8a. 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.

Signed-off-by: VenishPaneliya <141703684+VenishPaneliya@users.noreply.github.com>
@ntkathole
ntkathole force-pushed the fix-ray-closure-late-binding branch from d94fed2 to c7add8a Compare November 18, 2026 11:19
@ntkathole
ntkathole merged commit a6421ac into feast-dev:master Nov 18, 2026
21 of 22 checks passed
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.

3 participants