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>
wgtmac
reviewed
Nov 20, 2026
| } | ||
|
|
||
| private: | ||
| const std::shared_ptr<MetadataScanTask> task_; |
Member
There was a problem hiding this comment.
Do you plan to support multiple tasks in the future? I'm fine with the current implementation but we need to consider parallel task execution and serialization for better performance.
Keep FileIO on the metadata scan builder and retained snapshot tasks instead of scan configuration. Colocate snapshot and static task implementations, label the callback parameters, rename the metadata utility source, and document future task splitting and serialization. Verify captured FileIO survives source refresh and the builder, scan, task, and active stream lifetimes. Co-authored-by: Codex <codex@openai.com>
Exercise static metadata reads through StaticMetadataTask and MetadataScanTaskReader. The concrete SnapshotsScan was made private in apache#1139, so calling its factory prevents PR merge builds from compiling. Preserve the static-read FileIO regression through the public task API. 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. The table implementations follow in their own PRs.
A source-table refresh after
NewScan()must not change a builder's captured inputs. Built scans, tasks, and row streams retain their inputs for their own lifetimes. This PR supplies that ownership contract and builds directly on main.Changes and rationale
SchemaForScan(captured_metadata). FileIO is held separately fromMetadataScanContextand passed to the table'sMakeScan()hook, so snapshot tasks retain the captured IO even after a source refresh.SnapshotMetadataTaskalongsideStaticMetadataTaskinmetadata_scan_task.h/.cc. Its factory validates the context, FileIO, and row-reader callback.MetadataScanTaskReaderopens it through that callback, allowing table-specific readers without a dispatch branch for every table.MetadataScanContext::Validate(), check whole-column projections, and resolve snapshot IDs, references, or timestamps against captured metadata. Reference lookup reusesSnapshotUtil::LatestSnapshot()after strict reference validation. Empty main selections returnnullptr; dangling snapshot IDs remain errors. Main-branch detection is shared throughSnapshotUtil::IsMainBranch().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 metadata tables must also update their protected
MakeScan()override to accept the builder-capturedstd::shared_ptr<FileIO>as its second argument. The PR adds the protectedSchemaForScan()hook,SnapshotMetadataTask, andTaskKind::kSnapshot. Existing binary consumers must be rebuilt.Execution scope
The initial snapshot scan plans one task using an in-process row-reader callback. Splitting work into multiple tasks and providing serializable task descriptions are follow-up work for parallel and distributed execution.
Validation
Local validation covers the standalone static Debug scan implementation and tests, rebuilt against this revision with unchanged cached static dependencies. Dependent table PRs must pass captured FileIO separately when adapting their
MakeScan()overrides.