Repository navigation
Support schema evolution in legacy DeltaLake metadata parser - #101446
Daedalus-Icarus wants to merge 23 commits into
Conversation
|
Workflow [PR], commit [6c549b2] Summary: ✅
AI ReviewSummaryThis PR makes the legacy Findings
Final VerdictChanges requested. The table-function and checkpoint paths look good now, but the persistent legacy engine path still does not pick up evolved columns. |
Avogar
left a comment
There was a problem hiding this comment.
The fix is incomplete:
- There are no integration tests for schema evolution in legacy DeltaLake metadata parser. Please, try to write an integration test.
- If we allow schema evolution, we should also implement
DeltaLakeMetadata::modifyFormatSettingsthat will setformat_settings.parquet.allow_missing_columns = true - There are stale comments in
DeltaLakeMetadata.cpp:237-238about not supported schema evolution
1. Add integration test `test_schema_evolution_add_column_legacy` that verifies the legacy metadata parser (with DeltaKernel disabled) correctly handles schema evolution when columns are added. Old data files return NULLs for missing columns. 2. Implement `DeltaLakeMetadata::modifyFormatSettings` to set `format_settings.parquet.allow_missing_columns = true`, matching the existing `DeltaLakeMetadataDeltaKernel` behavior. Without this, the Parquet reader would reject files that lack columns added after initial table creation. 3. Fix stale comments in `DeltaLakeMetadata.cpp` that incorrectly stated schema evolution is not supported, and fix "partiion" typo.
…lity Spark writes all columns as nullable in Delta Lake JSON metadata regardless of the Spark `nullable` flag, so the legacy parser returns `Nullable` types. Update test expectations to match: `Nullable(Int32)` / `Nullable(String)`. Co-Authored-By: Claude Opus 4.6 <[email protected]>
The checkpoint parser had two separate loops: first iterating all rows to extract schema (updating `file_schema` to the latest version), then iterating again to extract data files and decode partition values using the final schema. This is incorrect when a checkpoint contains `metaData` entries from multiple schema versions interleaved with `add` entries: older rows' partition values would be decoded against the wrong (latest) schema, potentially throwing "No such column in schema" or mis-parsing values after a column rename/type change. Merge into a single pass so each `add` row's partition values are decoded against the schema active at that row's position, matching the behavior of `processMetadataFile`. Co-Authored-By: Claude Opus 4.6 <[email protected]>
|
The Stress test (arm_msan) failure is fixed by #101239, which should be merged first. After it is merged, please update the branch to include the fix. |
Checkpoint Parquet files have no guaranteed row ordering. If add rows with partition values appear before the metaData row that establishes the schema, the partition value decoder would fail with "No such column in schema" because `file_schema` is still empty. Fix: buffer add-row indices that arrive before schema is initialized. Once the metaData row is processed and `file_schema` is populated, decode the buffered rows immediately. File paths are still registered on first encounter regardless of schema availability. If the checkpoint has no metaData row at all (invalid), log a warning and skip partition decoding for those files instead of crashing.
|
Hi @kssenii is there any update on here? |
The `ErrorCodes::NOT_IMPLEMENTED` throws were removed when schema evolution support was added, but the declaration was left behind. The style check flags unused error code declarations. Co-Authored-By: Claude Opus 4.6 <[email protected]>
# Conflicts: # src/Storages/ObjectStorage/DataLakes/DeltaLakeMetadata.cpp
|
Dear @kssenii, 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. |
# Conflicts: # src/Storages/ObjectStorage/DataLakes/DeltaLakeMetadata.cpp
In the no-checkpoint path, `processMetadataFiles` replayed `_delta_log/*.json` entries in listing order, which is not guaranteed to be version order (e.g. local object storage lists in directory iteration order). Since schema evolution adopts the schema of the last processed `metaData` entry, an out-of-order listing could downgrade `file_schema` to an older schema. Sort the keys: delta log file names are zero-padded version numbers, so lexicographic order is version order. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Pushed two updates:
|
|
Merged The merge was conflict-free. |
|
|
||
| NamesAndTypesList getTableSchema(ContextPtr /*local_context*/) const override { return schema; } | ||
|
|
||
| void modifyFormatSettings(FormatSettings & format_settings, const Context &) const override; |
There was a problem hiding this comment.
This fixes the Parquet read once the new column is requested, but the persistent engine path can still keep stale columns after external schema evolution.
StorageObjectStorage::updateExternalDynamicMetadataIfExists calls configuration->update, then returns when getTableStateSnapshot is null; legacy DeltaLakeMetadata does not override that API. So an existing DeltaLakeAzure or legacy DeltaLake table created before an appended schema change keeps its old StorageInMemoryMetadata: DESCRIBE and query analysis will not see the added column, and SELECT age fails before modifyFormatSettings or the new parser can help.
The PR body promises the DeltaLakeAzure engine path too. Please refresh the storage metadata for the legacy path (or add a pinned table-state snapshot/rebuild path like DeltaLakeMetadataDeltaKernel) and cover it with a regression that creates the engine before the schema-evolved append.
|
Do we care about the old DeltaLake metadata parser? I don't think so. |
|
Merged |
Refresh CI: the branch was ~11 days behind master (merge-base 2026-06-22). The merge is conflict-free. Master has not touched DeltaLakeMetadata.cpp/.h; the only churn in the PR's footprint is in tests/integration/test_storage_delta/test.py (master's flaky-check tweaks), now incorporated. Verified the PR's DeltaLakeMetadata.cpp still compiles cleanly (-fsyntax-only) against current master headers.
|
Desel72 seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
|
Merged The previous run's only red — The PR remains blocked on the open question of whether the legacy (non-kernel) DeltaLake metadata parser is worth maintaining, and on the remaining review point that the persistent-engine path ( |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 42/69 (60.87%) · Uncovered code |
|
Hello! Is this PR going to be merged? |
|
It will be closed in ten days if no one answers the question #101446 (comment) |
|
Dear @kssenii, 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. |
The legacy
DeltaLakeMetadataImpl(used for Azure and non-kernel S3 paths) threwNOT_IMPLEMENTEDwhen encountering schema changes in_delta_logmetadata entries or checkpoint files. This madedeltaLakeAzurefail on tables with schema evolution (e.g., added columns).Instead of throwing, adopt the latest schema — matching the behavior of the DeltaKernel path. Delta log entries are processed in version order, so the last
metaDataentry always represents the current table schema. Older data files with fewer columns will return NULLs for missing columns, which is the expected behavior.Closes #100438
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
deltaLakeAzureand legacydeltaLake(non-kernel) failing withNOT_IMPLEMENTEDerror on schema-evolved tables. Schema evolution (e.g., adding columns) is now handled by adopting the latest schema, matching the DeltaKernel behavior.Documentation entry for user-facing changes
No documentation changes required — this is a bug fix aligning existing behavior with the documented DeltaKernel path.