Skip to content

Fix/18211 versioned scans - #27934

Open
HairstonE wants to merge 3 commits into
apache:mainfrom
HairstonE:fix/18211-versioned-scans
Open

HairstonE wants to merge 3 commits into
apache:mainfrom
HairstonE:fix/18211-versioned-scans

Conversation

@HairstonE

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

If a file is overwritten between planning and execution, the scan reads the new bytes through byte ranges computed from the old file. The reads fail or return wrong rows. The planning-time etag and version already sit in PartitionedFile::object_meta.

What changes are included in this PR?

An opt-in object_version_type (ETag or Version) on ListingOptions. At open time, each file's store is wrapped so that every read carries the planning-time etag or version in GetOptions. The store then rejects an overwritten file with a precondition error instead of serving mismatched bytes. With Version, a versioned store serves the planning-time object instead. Pinned plans refuse proto serialization until the PartitionedFile proto carries the pinned fields.

What is the testing strategy for this PR?

Integration tests in object_version_pinning.rs run across parquet, CSV, and JSON through a request-recording store. They assert that every read carries the pin, that a same-size overwrite fails only when pinned, and that a missing version id fails at open. Unit tests cover the off switch and the missing-metadata errors.

Are there any user-facing changes?

New opt-in API on ListingOptions and FileScanConfigBuilder. Defaults are unchanged. The new public struct fields can break struct-literal construction downstream.

@github-actions github-actions Bot added core Core DataFusion crate catalog Related to the catalog crate datasource Changes to the datasource crate labels Dec 1, 2026

#[tokio::test]
async fn version_pinning_without_version_errors_at_open() {
// InMemory reports no `version`, so Version pinning must fail cleanly

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.

InMemory reports no version ids, so there is no end-to-end Version test. Version shares the ETag path except which field it copies.

pub output_partitioning: Option<Partitioning>,
/// Pin parquet, CSV, and JSON reads to the etag or version captured at planning
/// time. Other formats and custom `ParquetFileReaderFactory` implementations are unpinned.
pub object_version_type: Option<ObjectVersionType>,

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.

AVRO, Arrow, and custom ParquetFileReaderFactory implementations are not pinned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

catalog Related to the catalog crate core Core DataFusion crate datasource Changes to the datasource crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ListingTable should support scanning against versioned object store files

1 participant