Skip to content

fix: Keep the source event timestamp separate from request data in Dask retrieval - #7177

Merged
ntkathole merged 3 commits into
feast-dev:masterfrom
iammanoj807:fix/dask-timestamp-field-request-column
Nov 22, 2026
Merged

ntkathole merged 3 commits into
feast-dev:masterfrom
iammanoj807:fix/dask-timestamp-field-request-column

Conversation

@iammanoj807

@iammanoj807 iammanoj807 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

In the file (Dask) offline store, get_historical_features merges each feature view's source data into the entity dataframe with suffixes=("", "__"). When the entity dataframe already has a column named like the source's timestamp_field, the source column becomes <name>__, but the TTL filter, the created-timestamp cutoff, deduplication and the final column drop all keep using <name>, which is now the request's column. As a result:

  • feature values come back missing, or from after the event timestamp;
  • the request's own column is dropped, and the source timestamp comes back as <name>__;
  • a request column of that name holding strings, integers or floats raises AttributeError: 'str' object has no attribute 'tzinfo';
  • a request with both ts and ts__ raises Duplicate column names found, or, with two feature views using ts, keeps allocating memory.

#7071 fixed this for the source's created_timestamp_column by keeping it under a temporary name. This PR does the same for timestamp_field, through a small _unused_column_name helper now shared by both renames. Because the check runs after _field_mapping, it also covers its __<event timestamp> alias when the request has a column with that name.

Adds test_dask_timestamp_field_collision.py (22 tests, through the public FeatureStore API with local Parquet files, like #7071's tests):

  • a request column named like the source timestamp field, holding a later, earlier or in-between timestamp, a string or an integer, with both settings of full_feature_names and filter_by_created_timestamp, next to request columns that take the temporary names;
  • a request column named like the __event_timestamp alias;
  • two feature views sharing a colliding timestamp field, with ts and ts__ in the request.

On master, the first 21 fail (9 missing values, 4 values from after the event timestamp, 8 errors) and the last one runs out of memory. All pass with this change.

Also adds test_historical_features_with_request_column_named_like_timestamp_field to the universal historical retrieval tests, so the case runs on every universal offline store. The source's timestamp_field is feature_timestamp, and the entity dataframe has its own feature_timestamp request column (later than, earlier than and between the source rows). It checks the latest eligible feature value for each request and that the request columns come back unchanged, with and without full feature names.

Which issue(s) this PR fixes:

Fixes #7176

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

Run locally:

  • Offline store unit tests, plus the other unit test files that call get_historical_features or the Dask store: the same results as master, plus the 22 new tests. The failures and errors are the same on master (optional dependencies not installed locally: Spark, Trino, Postgres, MLflow, Lance).
  • File and DuckDB universal offline store integration tests (sdk/python/tests/integration/offline_store): 94 passed and 5 skipped, which is the 90 that pass without the new test plus its 4 cases. Without the fix, the new test fails on the file store (the request column is dropped and feature_timestamp__ is added) and passes on DuckDB. test_dqm_validation.py is not collected locally.
  • ruff 0.16.10 passes on the changed files; mypy reports no new errors in dask.py.
  • Manual check: the reproducer from the issue, on master, 0.68.0 and this branch.
  • Randomised comparison against master, DuckDB and a brute-force point-in-time reference: 800 get_historical_features calls on the file store, with 1–3 feature views per call (timestamp fields ts, feature_ts and event_timestamp; with and without created columns; TTL set, 0 and unset), both full_feature_names settings, both filter_by_created_timestamp settings, and request columns named like the source timestamp and created columns, their temporary names, feature names and other labels, holding UTC, naive, string, integer and float values.
    • 147 calls had a request column named like a source timestamp field. Master got all 147 wrong (63 raised, 84 returned wrong or missing values or dropped the request column). This branch matched the reference on every value and returned the request columns unchanged in 143. Each of the other 4 is a separate, existing behaviour that is the same on master: 2 have a request column named like a requested feature (DuckDB raises Duplicate column name there), and 2 have request rows sharing a join key and timestamp (fix: Preserve distinct entity_df rows sharing a join key and timestamp in Dask offline store #6786).
    • The other 653 calls gave identical results on master and this branch.
    • DuckDB matched the reference on every call with a timestamp name collision.

Devin Review

@iammanoj807
iammanoj807 requested a review from a team as a code owner November 18, 2026 07:31

@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: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

@codecov-commenter

codecov-commenter commented Nov 18, 2026 •

Copy link
Copy Markdown

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

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.82%. Comparing base (025a02c) to head (331281d).
⚠️ Report is 3 commits behind head on master.
❗ 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    #7177      +/-   ##
==========================================
+ Coverage   53.70%   53.82%   +0.12%     
==========================================
  Files         462      462              
  Lines       58556    58639      +83     
  Branches     8637     8651      +14     
==========================================
+ Hits        31447    31562     +115     
+ Misses      24972    24938      -34     
- Partials     2137     2139       +2     
Flag Coverage Δ
go-feature-server 30.96% <ø> (ø)
python-unit 55.41% <100.00%> (+0.12%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/infra/offline_stores/dask.py 58.46% <100.00%> (+0.53%) ⬆️

... and 3 files with indirect coverage changes


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 439b131...331281d. 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.

@franciscojavierarceo franciscojavierarceo left a comment

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.

we need the required universal retrieval regression before merging this change.

)
store.apply([entity, *feature_views])
return store

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.

these cases exercise the public API but hard-code the file store, so they do not check the retrieval contract across the universal store matrix. the component rule requires a universal integration regression when retrieval behavior changes. we need to add the timestamp-name collision to test_universal_historical_retrieval.py using its source/store fixtures, checking the latest eligible feature value and unchanged request columns with both feature-name modes.

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.

Added in bb0ca85: test_historical_features_with_request_column_named_like_timestamp_field in test_universal_historical_retrieval.py, using its source and store fixtures. The source's timestamp_field is feature_timestamp, and the entity dataframe has its own feature_timestamp request column (later than, earlier than and between the source rows). The test checks the latest eligible feature value for each request and that the request columns come back unchanged, with and without full feature names. Without the fix it fails on the file store (the request column is dropped and feature_timestamp__ is added); with it, it passes on the file and DuckDB stores.

@franciscojavierarceo franciscojavierarceo left a comment

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.

the added universal regression exposes a Ray point-in-time failure that needs to be handled before merging.

)
store.apply([driver, trips_fv])

actual_df = store.get_historical_features(

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.

the new universal case fails in Ray CI in both feature-name modes: expected [20, 20, 40], actual [30.0, nan, 40.0]. Ray uses the request's feature_timestamp as the cutoff when that column exists, so the first result comes from after event_timestamp. this exposes an existing Ray bug, but leaves the new suite red. we need to fix that path or narrowly mark this known Ray failure with a tracked issue while preserving the file-store assertions.

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.

Thanks! I checked it, and the Ray failure isn't caused by this PR. Running the new test on master without the Dask change, Ray gives the same [30.0, nan, 40.0] (Ray 2.58.0), and 0.68.0 does the same. I've opened #7190 for it.

In 796e6b1 I marked only the Ray case as a known failure (xfail(strict=True), linking #7190), so the file-store and DuckDB assertions are unchanged, and the test will turn red again once Ray is fixed, as a reminder to remove the mark. The Ray offline suite now gives 52 passed, 2 xfailed, 4 skipped (CI had 52 passed, 2 failed).

I'm happy to fix the Ray path in a follow-up PR.

…sk retrieval

When the entity dataframe had a column named like a feature view's source
timestamp_field, the merge suffixed the source column, so the TTL filter,
the created-timestamp cutoff, deduplication and the column drop read the
request's column instead. Features came back missing or from after the
event timestamp, the request column was dropped, non-timestamp values
raised, and a request with both ts and ts__ failed or kept allocating
memory.

Keep the source timestamp under an unused temporary name, as feast-dev#7071 does
for the created timestamp column.

Signed-off-by: Manoj Kumar Thapa <iammanoj807@gmail.com>
…universal retrieval

Signed-off-by: Manoj Kumar Thapa <iammanoj807@gmail.com>
…own failure

The Ray offline store uses an entity dataframe column named like the
source timestamp field as the point-in-time cutoff (feast-dev#7190). Mark only the
Ray case as a strict xfail so the file and DuckDB assertions still run.

Signed-off-by: Manoj Kumar Thapa <iammanoj807@gmail.com>
@ntkathole
ntkathole force-pushed the fix/dask-timestamp-field-request-column branch from 994ede4 to 331281d Compare November 22, 2026 12:59
@ntkathole
ntkathole merged commit 42ed604 into feast-dev:master Nov 22, 2026
18 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.

File offline store returns wrong or future feature values when the entity dataframe has a column named like the source timestamp field

4 participants