Repository navigation
Conversation
|
Workflow [PR], commit [8bb2278] Summary: ❌
AI ReviewSummaryThis PR teaches Iceberg reads to tolerate snapshots that omit Findings❌ Blockers
Final Verdict
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes5 object files changed (+51.85 KiB total), 0 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units32 translation units recompiled, 345 s compile time in total, 32 of them have a recent master baseline. Median compile-time ratio to the baselines is ×0.90 (machine-speed difference or a change affecting every TU); per-TU deltas below are relative to that ratio. |
| metadata = json.load(metadata_file) | ||
|
|
||
| current_snapshot_id = metadata["current-snapshot-id"] | ||
| if mode == "historical": |
There was a problem hiding this comment.
really strange test, do you have some ready table or could you please generate it explicitly with spark?
There was a problem hiding this comment.
Replaced the test with a Spark-generated Iceberg fixture in data_minio/iceberg_optional_snapshot_schema_id, produced by generate.py via iceberg-spark-runtime. Updated 05052_iceberg_optional_snapshot_schema_id.sh to query the table across snapshots.
The Iceberg specification allows snapshots in older versions (e.g. v1 or legacy writers) to omit `schema-id`. When `schema-id` is missing in snapshot metadata, fall back to the current table schema id instead of failing. Includes stateless test using Spark-generated legacy snapshot fixtures. Signed-off-by: 1fanwang <[email protected]>
9202d90 to
99c695f
Compare
Verify both current and historical snapshot reads when snapshot schema-id is explicitly JSON null in metadata, exercising the !snapshot->isNull(f_schema_id) guards in traverseMetadataAndFindNecessarySnapshotObject and createIcebergDataSnapshotFromSnapshotJSON. Signed-off-by: 1fanwang <[email protected]>
…ema-id Allow reading tables using Iceberg format-version 1 metadata where top-level schema omits schema-id (defaulting to current-schema-id or 0) and schemas array is absent. Register the top-level schema in traverseMetadataAndFindNecessarySnapshotObject and support v1 schema resolution in getSortingKey and getSortingKeyDescriptionFromMetadata. Add tests querying raw legacy v3 metadata. Signed-off-by: 1fanwang <[email protected]>
Add column `extra STRING` in `v5.metadata.json` and `generate.py`, and assert that time-travel queries of historical snapshots without snapshot `schema-id` expose the evolved column as NULL. Signed-off-by: 1fanwang <[email protected]>
Iceberg v1 makes the manifest schema ID optional and assigns the initial schema ID when it is absent. Legacy Spark manifests therefore failed before the snapshot fallback could take effect. Signed-off-by: Stefan Wang <[email protected]>
The PR no longer merged cleanly after manifest schema selection changed on master. Keeping it current lets CI exercise the legacy fallback through the supported path. Signed-off-by: Stefan Wang <[email protected]>
The parsed schema pointer was held through a const wrapper, which prevented adding the spec-defined fallback ID and stopped arm_tidy before the regression could run. Signed-off-by: Stefan Wang <[email protected]>
| schema_processor->registerSnapshotWithSchemaId(current_snapshot_id, current_schema_id); | ||
| if (snapshot->getValue<Int64>(f_metadata_snapshot_id) == snapshot_id) | ||
| const auto current_snapshot_id = snapshot->getValue<Int64>(f_metadata_snapshot_id); | ||
| if (snapshot->has(f_schema_id) && !snapshot->isNull(f_schema_id)) |
There was a problem hiding this comment.
Skipping registerSnapshotWithSchemaId for legacy snapshots makes them indistinguishable from expired snapshots downstream. ManifestFileIterator::processRow treats !tryGetSchemaIdForSnapshot(...) as "snapshot metadata is gone" and falls back to the manifest header schema instead.
That is not safe once manifests are rewritten. ClickHouse's metadata-only rewrites keep each entry's original snapshot_id (src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergWrites.cpp:587, src/Storages/ObjectStorage/DataLakes/Iceberg/Compaction.cpp:1258), but the new manifest header is written with the current table schema (src/Storages/ObjectStorage/DataLakes/Iceberg/IcebergWrites.cpp:559). For a legacy v1 table that later renames or type-changes a column, old files from a snapshot without schema-id will now be attributed to that rewritten header schema, so the read path stops taking the old-schema transform route that StorageObjectStorage.cpp:349 relies on for schema evolution.
Please keep a distinct mapping for "snapshot exists but omitted schema-id" instead of letting it fall into the same path as an actually missing/expired snapshot, and add a regression that rewrites manifests after a schema evolution on this legacy fixture.
The generated null-schema metadata fixture used a filename that metadata discovery rejects, so targeted CI failed before exercising the intended fallback. Signed-off-by: 1fanwang <[email protected]>
9d9bd1b to
8bb2278
Compare
|
Dear @scanhex12, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself. |
Closes: #100304
Related: #114465
Iceberg snapshots may omit the optional
schema-idfield. ClickHouse currently converts the missing value to an integer unconditionally, so one valid current or historical snapshot can make the table unreadable withPoco::InvalidAccessException.This change uses the table's current schema as the fallback, matching Iceberg's reference behavior. Explicit snapshot schema IDs still take precedence, and manifest reads retain their existing schema fallback.
Testing
The official master build at
2af4f37af27fba2b561f4984d95ff1703a7e2c00reproduces both forms:The new stateless test covers absent and null IDs on the selected snapshot, an older historical snapshot without an ID, and time travel to that snapshot. A post-fix ClickHouse binary was not available locally, so runtime green is deferred to CI. The shell and embedded Python parse cleanly; shellcheck and changed-line clang-format pass.
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix reading Iceberg tables when a current or historical snapshot omits its optional schema ID.
Workflow [PR]
Sync PR [sync-upstream/pr/117112]