Repository navigation
Conversation
…count shortcuts `StorageObjectStorageSource::createReader` has two shortcuts that answer without reading the data file: constant columns taken from the file statistics (`allow_experimental_iceberg_read_optimization`) and the cached row count (`use_cache_for_count_from_files`). Both skipped `getSchemaTransformer`, which is where Iceberg rejects metadata that violates the specification, so the outcome for the same metadata depended on the file statistics and on the cache: - A primitive column turned into a struct: every column of a single-row file is constant, so the read needed nothing from the file. When the row count was cached, the statistics value of the old type (`Int64`) was inserted into a column of the new type (`Tuple`) and the query failed with `BAD_GET` instead of `ICEBERG_SPECIFICATION_VIOLATION`. When the cache entry was not valid, the file was read and the expected exception was raised. The cache entry is valid only if the data file is older than the entry, compared in whole seconds, so `04890_iceberg_metadata_spec_violation_no_abort` failed about once per ten runs. - A required column added to the schema: `SELECT count()` was answered from the cached row count and returned a result for metadata that `SELECT *` rejects. Call `getSchemaTransformer` for the file before the shortcuts. It returns immediately for a file written under the current schema, and the transformation is cached per pair of schemas. Add a test that fills the row count cache and then evolves the schema. It fails with `BAD_GET` and with a returned count without the change. CI report: https://altinity-build-artifacts.s3.amazonaws.com/json.html?PR=2917&sha=939a6bde149e96eedf97bbdf1d3df5f285f1d502&name_0=PR&name_1=Stateless+tests+%28amd_binary%2C+cas+s3+storage%2C+parallel%29&name_2=Tests Related: #2917 Co-authored-by: Cursor <cursoragent@cursor.com>
ianton-ru
marked this pull request as draft
November 23, 2026 11:17
This was referenced Nov 25, 2026
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.
StorageObjectStorageSource::createReaderhas two shortcuts that answer without reading the data file: constant columns taken from the file statistics (allow_experimental_iceberg_read_optimization) and the cached row count (use_cache_for_count_from_files). Both skippedgetSchemaTransformer, which is where Iceberg rejects metadata that violates the specification, so the outcome for the same metadata depended on the file statistics and on the cache:Int64) was inserted into a column of the new type (Tuple) and the query failed withBAD_GETinstead ofICEBERG_SPECIFICATION_VIOLATION. When the cache entry was not valid, the file was read and the expected exception was raised. The cache entry is valid only if the data file is older than the entry, compared in whole seconds, so04890_iceberg_metadata_spec_violation_no_abortfailed about once per ten runs.SELECT count()was answered from the cached row count and returned a result for metadata thatSELECT *rejects.The change calls
getSchemaTransformerfor the file before the shortcuts. It returns immediately for a file written under the current schema, and the transformation is cached per pair of schemas.The new test
05814_iceberg_schema_evolution_validated_before_shortcutsfills the row count cache and then evolves the schema. It fails withBAD_GETand with a returned count without the change. All 119 Iceberg functional tests pass in docker through Praktika on a build ofantalya-26.8with the change.The flaky failure was seen in https://altinity-build-artifacts.s3.amazonaws.com/json.html?PR=2917&sha=939a6bde149e96eedf97bbdf1d3df5f285f1d502&name_0=PR&name_1=Stateless+tests+%28amd_binary%2C+cas+s3+storage%2C+parallel%29&name_2=Tests
Related: #2917
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Validate the Iceberg schema evolution of a data file before answering from file statistics or from the cached row count, so metadata that violates the specification is rejected with
ICEBERG_SPECIFICATION_VIOLATIONinstead of failing withBAD_GETor returning a result.Documentation entry for user-facing changes
Not needed.
CI/CD Options
Exclude tests:
Regression jobs to run: