Repository navigation
Conversation
…sert-schema-drift
…planning An `INSERT` analysed before a concurrent `ALTER TABLE ... DROP COLUMN` or `RENAME COLUMN` writes a block with a column that the table's current schema no longer has. The data file statistics then fell back to the schema's field ids, keyed by position, which do not match the written columns, and the column was written without a field id. Throw the same retryable "metadata changed" error that the commit already raises for a schema change, instead of falling back. A block that is narrower than the schema (a column added after planning) is still accepted. Related: #121821 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
|
Workflow [PR], commit [e0f61eb] Summary: ❌
|
Only the `Parquet` writer checked that every field of the written block, including nested ones, has a field id in the schema being written. The `ORC` and `Avro` writers silently left a missing id unset. Move the recursive check (`validateIcebergFieldIds`) next to `ColumnMapper` and run it in `MultipleFileWriter` for every format, with the existing error that asks to retry the `INSERT`. The test now covers `Parquet`, `ORC` and `Avro`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Related: #121821
#121821 lets an
INSERTinto anIcebergtable succeed when a column was added after the query was analysed. The opposite case, a column (or a nested field) dropped or renamed after analysis, leaves the written block with a field that the table's current schema does not contain. Only theParquetwriter detected this, through its recursive field id check. TheORCandAvrowriters wrote such a field without an Iceberg field id, and the data file statistics fell back to the schema's field ids keyed by position, which do not match the written columns.The recursive check (
validateIcebergFieldIds) now lives next toColumnMapperand runs inMultipleFileWriterfor every format, so such anINSERTfails with the existing error that asks to retry it. A block that only lacks fields of the current schema is still accepted. The data file statistics take the written columns' field ids without a fallback.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
An
INSERTinto anIcebergtable inORCorAvroformat now fails with an error that asks to retry it whenALTER TABLE ... DROP COLUMNorRENAME COLUMNcommits while theINSERTis running, instead of writing a data file whose columns do not match the table schema.Workflow [PR]
Sync PR [sync-upstream/pr/125095]