Repository navigation
Conversation
This was referenced Nov 14, 2026
Extract a focused piece from the metadata table implementation with its tests. Co-authored-by: Codex <codex@openai.com>
manuzhang
force-pushed
the
codex/metadata-scan-support-20261115
branch
from
November 15, 2026 15:26
f11adff to
33c84fb
Compare
This was referenced Nov 15, 2026
Remove the private SnapshotAtRef helper. Validate explicit references and handle an empty main snapshot before delegating to LatestSnapshot, so missing references and dangling snapshot IDs still fail. Cover empty tables, missing/null references, and dangling snapshot IDs. Co-authored-by: Codex <codex@openai.com>
manuzhang
marked this pull request as draft
November 16, 2026 15:18
Extract SnapshotUtil::IsMainBranch and reuse it for metadata snapshot selection, schema lookup, and latest snapshot lookup. Co-authored-by: Codex <codex@openai.com>
Document the retained snapshot task, deferred row-reader callback, and fresh task streams returned by repeated planning. Co-authored-by: Codex <codex@openai.com>
Validate common metadata and schema inputs through MetadataScanContext::Validate at builder and scan factory boundaries. Keep FileIO validation specific to snapshot scans and cover direct factory input validation and static scans without FileIO. Co-authored-by: Codex <codex@openai.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Regular data-table scans already support snapshot selection through
UseSnapshot(),UseRef(), andAsOfTime().MetadataScanBuilderalso already exposes these selectors, but its implemented metadata tables (snapshots,history, andrefs) use in-memory static tasks and reject time-travel selection.This PR adds a generic snapshot-task execution path for the upcoming FilesTable (#876), ManifestsTable (#1121), and PartitionsTable (#1122) implementations. Those tables need to read metadata rows for a selected snapshot. It reuses the existing selector API and snapshot lookup utilities; the table implementations follow in their own PRs.
For those new tables, a source-table refresh after
NewScan()must not change the metadata or schema used by that builder's scans. Built scans and tasks must retain their inputs after the metadata table or task reader is released. This PR supplies that ownership contract and builds directly on main.Changes and rationale
SchemaForScan(captured_metadata). This lets tables with evolving schemas use the same metadata version for their schema and rows.SnapshotMetadataTaskto retain the scan context and a row-reader function pointer.MetadataScanTaskReaderopens the task through that callback, so each metadata table can supply its reader without adding a table-specific dispatch branch.SnapshotUtil::LatestSnapshot()after checking that a requested reference exists and is non-null; a main-branch selection with no current snapshot resolves tonullptr, while dangling snapshot IDs remain errors. Tasks can be reopened with independent streams and configurable batch sizes.Public API and ABI changes
The public virtual getter changes its return type:
The member function remains
const. Returning the pointer by value lets implementations copy it under their schema-cache lock, giving callers ownership that remains valid when the cache is replaced. This copies theshared_ptr, not theSchema.Derived classes must update their overrides, some reference-binding callers need changes, and existing binary consumers must be rebuilt. The PR also adds the protected virtual
SchemaForScan()hook andTaskKind::kSnapshot.Validation
std::bad_castwhile writing fixtures, before the new helper runs; the same failure reproduces in unchanged existing manifest-writer tests. The full shared runtime suite is therefore not reported as passing.