Skip to content

fix: Read Delta Lake tables through the current snapshot in the Dask offline store - #7229

Open
Bensonluo wants to merge 3 commits into
feast-dev:masterfrom
Bensonluo:fix/dask-delta-lake-snapshot-reads
Open

Bensonluo wants to merge 3 commits into
feast-dev:masterfrom
Bensonluo:fix/dask-delta-lake-snapshot-reads

Conversation

@Bensonluo

@Bensonluo Bensonluo commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

The Dask offline store treated FileSource(file_format=DeltaFormat()) as a Parquet directory. After an overwrite or compaction, obsolete data files can remain on disk until vacuuming. Reading those files alongside the active files can return stale or duplicate rows.

  • Historical retrieval and the latest and all-row pulls read the current Delta snapshot through a lazy Dask frame. The Delta log supplies partition values and types, and an empty snapshot still exposes its columns. Nullable integers keep their precision when fragments are assembled. The reader rejects unsupported Delta features instead of bypassing them with a raw Parquet read.
  • Monitoring reads the current snapshot. For a missing Delta table it returns no metrics and no max timestamp. For an existing empty snapshot the max timestamp is None and metrics for requested columns have zero rows. Retrieval and monitoring interpret timezone-naive Delta timestamps and time bounds as UTC when comparing times.
  • Batch writes to a Delta FileSource raise NotImplementedError before invoking the Parquet writer, which cannot commit to a Delta transaction log.
  • Saved datasets persist as Parquet: DaskRetrievalJob.persist rejects SavedDatasetFileStorage(file_format=DeltaFormat()) before writing anything, so creation can no longer succeed while retrieval later fails on a missing transaction log. Reading a DeltaFormat source without a _delta_log raises a recovery-guidance error that covers saved datasets written as plain Parquet under a Delta declaration by earlier Feast versions.
  • Explicit and default Parquet sources retain their existing paths. Reads reject other declared formats with NotImplementedError.

Which issue(s) this PR fixes:

Fixes #7221

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

The seven local Dask unit suites passed (121 cases). The regression tests retain physical files from an overwritten snapshot and verify historical retrieval, latest and all-row pulls, and monitoring. They also cover typed and escaped partitions, nullable integers, empty and missing snapshots, UTC time bounds, unsupported formats and reader features, rejection of Delta writes and DeltaFormat saved-dataset storage, the Parquet saved-dataset round-trip, the recovery guidance for Delta-labelled Parquet directories, and unchanged Parquet reads and writes. S3 option forwarding is tested with mocks; integration tests were not run.

Ruff lint and format checks passed on both changed Python files. A focused mypy comparison on dask.py reported the same three diagnostics on the base and the candidate.

Misc

/kind bug

Release note: Dask offline reads now honor the current Delta Lake snapshot when using FileSource with DeltaFormat and the feast[delta] extra. Dask batch writes to Delta tables are not supported, and DeltaFormat saved-dataset storage is rejected at creation.


Devin Review

…offline store

The Dask offline store read every FileSource through dd.read_parquet on
the source directory, ignoring file_format=DeltaFormat(). After a Delta
overwrite or compaction, data files removed by the transaction log can
remain on disk until they are vacuumed, so historical retrieval,
materialization pulls, and monitoring reads could return stale or
duplicated rows instead of the current snapshot.

- Read the Delta snapshot's Arrow dataset: partition values and their
  types come from the transaction log, an empty snapshot still exposes
  its columns, and reader features the installed delta-rs reader does
  not support are rejected instead of being bypassed with a raw Parquet
  read. Data is read only inside Dask tasks, one fragment per task, and
  nullable integers keep their pandas dtypes when fragments are
  assembled.
- Treat timezone-naive Delta timestamps and time bounds as UTC when
  comparing times, in retrieval and monitoring.
- compute_monitoring_metrics and get_monitoring_max_timestamp read the
  current snapshot. A missing Delta table yields no metrics and no max
  timestamp, while an existing empty snapshot yields zero-row metric
  summaries and a None max timestamp.
- offline_write_batch raises NotImplementedError for DeltaFormat before
  invoking the Parquet writer, which cannot commit to the Delta
  transaction log.
- Reads reject formats other than Parquet and Delta with
  NotImplementedError, mirroring the DuckDB offline store. Explicit and
  default Parquet sources keep their existing paths.
- Document the Parquet/Delta read support, the write restriction, and
  the absolute-path requirement in the Dask offline store reference.

Fixes feast-dev#7221

Signed-off-by: Benson LUO <luopengllpp@hotmail.com>
@Bensonluo
Bensonluo requested a review from a team as a code owner November 24, 2026 15:50

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

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 24, 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 95.31250% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 54.26%. Comparing base (a291a0f) to head (e61ae61).

Files with missing lines Patch % Lines
sdk/python/feast/infra/offline_stores/dask.py 95.31% 5 Missing and 1 partial ⚠️
❗ 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    #7229      +/-   ##
==========================================
+ Coverage   54.10%   54.26%   +0.16%     
==========================================
  Files         467      467              
  Lines       58940    59041     +101     
  Branches     8688     8712      +24     
==========================================
+ Hits        31890    32041     +151     
+ Misses      24892    24837      -55     
- Partials     2158     2163       +5     
Flag Coverage Δ
go-feature-server 30.96% <ø> (ø)
python-unit 55.87% <95.31%> (+0.17%) ⬆️
Files with missing lines Coverage Δ
sdk/python/feast/infra/offline_stores/dask.py 72.46% <95.31%> (+13.99%) ⬆️

... and 1 file 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...e61ae61. 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: Benson LUO <luopengllpp@hotmail.com>

@haoxu0 haoxu0 left a comment

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.

LGTM, is it possible to abstract this so that works with other offline store?

@Bensonluo

Copy link
Copy Markdown
Contributor Author

LGTM, is it possible to abstract this so that works with other offline store?

sure, no problem

@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 saved-dataset format mismatch before merging. DaskRetrievalJob.persist still writes Parquet for SavedDatasetFileStorage(file_format=DeltaFormat()), while to_data_source preserves that Delta declaration and the new reader requires a transaction log. creation therefore succeeds but retrieval fails; the offline_write_batch guard does not cover this path. we should either persist the declared format or reject Delta storage before writing files, add a create/retrieve regression, and provide recovery guidance for existing Delta-labelled Parquet saved datasets while keeping actual Delta reads snapshot-correct.

DaskRetrievalJob.persist wrote plain Parquet files even when the saved
dataset storage declared DeltaFormat, so creation succeeded while
retrieval failed: the Dask Delta reader requires a transaction log.
Reject DeltaFormat saved-dataset storage before writing anything, and
raise a recovery-guidance error when a DeltaFormat source has no Delta
transaction log, covering saved datasets that earlier Feast versions
wrote as plain Parquet under a Delta declaration.

Signed-off-by: Benson LUO <luopengllpp@hotmail.com>
@Bensonluo

Copy link
Copy Markdown
Contributor Author

Addressed in e61ae61 (saved-dataset format mismatch):

  • DaskRetrievalJob.persist now rejects SavedDatasetFileStorage(file_format=DeltaFormat()) with NotImplementedError before writing anything, mirroring the offline_write_batch guard. Creation can no longer succeed while retrieval later fails on the missing transaction log; persisting with ParquetFormat storage is the supported path.
  • Reading a DeltaFormat source that has no _delta_log now raises a TableNotFoundError whose message gives recovery guidance for legacy saved datasets: re-create the saved dataset with ParquetFormat storage, or register the directory as a ParquetFormat FileSource to keep reading the existing Parquet files. Delta snapshot reads themselves are unchanged.
  • Added the create/retrieve regression: a Parquet persist round-trips through the retrieval reader, DeltaFormat storage is rejected before any file is written, and a Delta-labelled Parquet directory surfaces the guidance error. The Dask docs now state the supported saved-dataset format and the recovery path.

The cross-store read abstraction will follow in a separate proposal.

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.

Dask offline store does not read Delta Lake tables

4 participants