Skip to content

fix: Keep the new event range of an overwritten SavedDataset - #7212

Open
ShivamSharma43 wants to merge 3 commits into
feast-dev:masterfrom
ShivamSharma43:fix/saved-dataset-timestamps
Open

ShivamSharma43 wants to merge 3 commits into
feast-dev:masterfrom
ShivamSharma43:fix/saved-dataset-timestamps

Conversation

@ShivamSharma43

@ShivamSharma43 ShivamSharma43 commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

With a file-based registry, overwriting a saved dataset makes its new data unreadable.

create_saved_dataset(..., allow_overwrite=True) sets the dataset's min_event_timestamp and max_event_timestamp from the new retrieval job. When the dataset already exists, Registry.apply_saved_dataset replaces both with the stored values. get_saved_dataset then filters the new data by the old range. Saving the same dataset twice from a local store:

rows written rows read by get_saved_dataset before after
first save, days 1-3 3 3 3
overwrite with days 11-13 3 0 3

If the stored dataset has no range, the same code stores 1970-01-01 for both timestamps.

The stored range is now kept only when the applied dataset doesn't have its own. Preserving it was added in #4257 for datasets that are re-applied without one, and that still works.

A dataset without a range is now read unbounded. Datasets registered from existing storage (POST /saved_datasets, which the UI's edit dialog also sends with allow_override) have no range, and with the change above editing one keeps it absent. PassthroughProvider.retrieve_saved_dataset called make_tzaware on the missing lower bound and added a second to the missing upper bound, so the dataset preview (GET /saved_datasets/data/{name}) returned HTTP 500. A missing bound is now passed to pull_all_from_table_or_query as None, which the offline stores treat as an open end of the range (the base signature takes Optional[datetime], and the SQL stores build the filter with get_timestamp_filter_sql, which skips a missing bound). The contrib ClickHouse store is the exception: it always filters with BETWEEN on both bounds, so this does not change it.

SavedDataset.to_proto also never wrote last_updated_timestamp, so it was always None when read back, although the registries set it and from_proto reads it. It's written now.

Which issue(s) this PR fixes:

No issue filed; found while reading the registry code.

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

  • New sdk/python/tests/unit/infra/registry/test_saved_dataset_timestamps.py: on master 4 of its 5 cases fail, with the fix all pass. The fifth (a stored range is kept when the new dataset has none) passes both ways.

  • New cases in sdk/python/tests/unit/infra/test_provider.py check the bounds retrieve_saved_dataset passes to the offline store (none, either one, both), and test_saved_dataset_preview_without_event_range_via_rest in sdk/python/tests/unit/api/test_api_rest_registry.py registers a Parquet file over REST, edits it, and reads the preview. Without the provider change 3 of the 4 provider cases fail and the preview returns 500; with it they pass. test_api_rest_registry.py, test_provider.py, test_saved_dataset_timestamps.py and test_saved_dataset_storage_dispatch.py together: 108 passed, 1 skipped.

  • The table comes from a script that saves the dataset twice with a local FeatureStore (file registry, dask offline store). With a SQLite sql registry the same script reads 3 rows before and after.

  • The other file, SQL and proto registry unit tests that could run locally pass (75 passed, 1 skipped). The remote and Snowflake registry tests and the integration tests were not run locally.

  • ruff check and ruff format are clean. mypy on the two changed modules reports one error, the same as on master. mypy reports no errors in passthrough_provider.py.

Misc

This change was prepared with AI assistance (Claude Code), which also ran the tests listed above.

🤖 Generated with Claude Code


Devin Review

Registry.apply_saved_dataset replaced the event range of a re-applied
dataset with the stored one, so get_saved_dataset filtered the new data by
the old range. Keep the stored range only if the new dataset has none.

Also write last_updated_timestamp in SavedDataset.to_proto.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
@ShivamSharma43
ShivamSharma43 requested a review from a team as a code owner November 22, 2026 17:41
Copilot AI balanced review requested due to automatic review settings November 22, 2026 17:41

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@codecov-commenter

codecov-commenter commented Nov 22, 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 54.25%. Comparing base (a291a0f) to head (457ac39).
❗ 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    #7212      +/-   ##
==========================================
+ Coverage   54.10%   54.25%   +0.15%     
==========================================
  Files         467      467              
  Lines       58940    58951      +11     
  Branches     8688     8693       +5     
==========================================
+ Hits        31890    31985      +95     
+ Misses      24892    24794      -98     
- Partials     2158     2172      +14     
Flag Coverage Δ
go-feature-server 30.96% <ø> (ø)
python-unit 55.86% <100.00%> (+0.16%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/infra/passthrough_provider.py 64.70% <100.00%> (+3.08%) ⬆️
sdk/python/feast/infra/registry/registry.py 67.15% <100.00%> (+1.10%) ⬆️
sdk/python/feast/saved_dataset.py 70.95% <100.00%> (+5.08%) ⬆️

... and 5 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 a291a0f...457ac39. 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.

@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.

2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

Comment on lines +1295 to +1306
if saved_dataset.min_event_timestamp is None and existing_meta.HasField(
"min_event_timestamp"
):
saved_dataset.min_event_timestamp = (
existing_meta.min_event_timestamp.ToDatetime()
)
if saved_dataset.max_event_timestamp is None and existing_meta.HasField(
"max_event_timestamp"
):
saved_dataset.max_event_timestamp = (
existing_meta.max_event_timestamp.ToDatetime()
)

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.

🟡 Dataset preview errors after metadata edits

When a user edits a registered dataset with no event bounds, apply_saved_dataset leaves both bounds unset. The saved dataset reader requires both, so the preview returns HTTP 500 instead of an empty result.

Learn more

Register Dataset registers existing storage without supplying event timestamps, and Edit Dataset sends the same registration request with overwrite enabled. Before this change, editing a registration with no bounds replaced them with epoch timestamps, so the file offline store could execute the preview query, albeit with the wrong range. The new behavior keeps the bounds absent, but retrieve_saved_dataset still converts the lower bound and adds a second to the upper bound unconditionally. The preview endpoint turns the resulting exception into HTTP 500.

Example: Register a Parquet file containing January 2026 rows, then edit only the dataset description and open the sample tab. Before this change, the sample request succeeded with zero rows because it filtered near the epoch. It now fails before querying the file.

Recommended fix: Keep absent bounds absent in the registry. Make PassthroughProvider.retrieve_saved_dataset handle missing bounds explicitly, translating them to unbounded reads where supported. The Dask file store already skips the corresponding filters. Add a regression test for previewing an edited registration without event bounds.

Devin Review


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

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.

Fixed in 457ac39. PassthroughProvider.retrieve_saved_dataset now passes a missing min_event_timestamp or max_event_timestamp to pull_all_from_table_or_query as None instead of converting it, so a dataset without an event range is read unbounded on that side. The bounds that are set are handled as before (tz-aware, one second added to the upper one).

Tests added: test_saved_dataset_preview_without_event_range_via_rest registers a Parquet file over REST, edits it with allow_override, checks no range is stored, and reads GET /saved_datasets/data/{name} (3 rows; returned 500 before the change). test_retrieve_saved_dataset_leaves_missing_event_bounds_open in tests/unit/infra/test_provider.py covers no bounds, either bound, and both.

@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 to address the existing missing event bounds finding before merging. preserving absent bounds is correct, but retrieve_saved_dataset still calls make_tzaware on the missing lower bound and adds a second to the missing upper bound, so editing a registered dataset without bounds makes its preview fail. we should handle unbounded reads explicitly and add a preview regression for that path.

ShivamSharma43 and others added 2 commits November 24, 2026 01:08
…saved-dataset-timestamps

Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
A dataset registered from existing storage has no event range, and
editing it now keeps the range absent. retrieve_saved_dataset still
converted the missing lower bound and added a second to the missing
upper bound, so its preview failed with HTTP 500.

Pass a missing bound to pull_all_from_table_or_query as None, which
the offline stores treat as an open end of the range.

Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ShivamSharma43

Copy link
Copy Markdown
Contributor Author

@franciscojavierarceo pushed 457ac39 (after merging master). retrieve_saved_dataset now reads a missing event bound as unbounded (None to pull_all_from_table_or_query) instead of calling make_tzaware on it or adding a second to it, and there is a REST preview regression test for an edited registration without bounds, plus unit cases for the provider. Details in the thread above and in the updated description.

This branch has not been deployed

No deployments
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.

4 participants