Repository navigation
fix: Keep the new event range of an overwritten SavedDataset - #7212
ShivamSharma43 wants to merge 3 commits into
Conversation
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>
There was a problem hiding this comment.
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
... and 5 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Devin Review found 1 potential issue.
2 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)
| 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() | ||
| ) |
There was a problem hiding this comment.
🟡 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.
Was this helpful? React with 👍 or 👎 to provide feedback.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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.
…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>
|
@franciscojavierarceo pushed 457ac39 (after merging master). |
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'smin_event_timestampandmax_event_timestampfrom the new retrieval job. When the dataset already exists,Registry.apply_saved_datasetreplaces both with the stored values.get_saved_datasetthen filters the new data by the old range. Saving the same dataset twice from a local store:get_saved_datasetbeforeIf 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 withallow_override) have no range, and with the change above editing one keeps it absent.PassthroughProvider.retrieve_saved_datasetcalledmake_tzawareon 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 topull_all_from_table_or_queryasNone, which the offline stores treat as an open end of the range (the base signature takesOptional[datetime], and the SQL stores build the filter withget_timestamp_filter_sql, which skips a missing bound). The contrib ClickHouse store is the exception: it always filters withBETWEENon both bounds, so this does not change it.SavedDataset.to_protoalso never wrotelast_updated_timestamp, so it was alwaysNonewhen read back, although the registries set it andfrom_protoreads it. It's written now.Which issue(s) this PR fixes:
No issue filed; found while reading the registry code.
Checks
git commit -s)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.pycheck the boundsretrieve_saved_datasetpasses to the offline store (none, either one, both), andtest_saved_dataset_preview_without_event_range_via_restinsdk/python/tests/unit/api/test_api_rest_registry.pyregisters 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.pyandtest_saved_dataset_storage_dispatch.pytogether: 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 SQLitesqlregistry 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 checkandruff formatare clean.mypyon the two changed modules reports one error, the same as on master.mypyreports no errors inpassthrough_provider.py.Misc
This change was prepared with AI assistance (Claude Code), which also ran the tests listed above.
🤖 Generated with Claude Code