Data: Fix bounds assertions in testMaxColumnsWithDefaultOverride#17269
Draft
thswlsqls wants to merge 1 commit into
Draft
Data: Fix bounds assertions in testMaxColumnsWithDefaultOverride#17269thswlsqls wants to merge 1 commit into
thswlsqls wants to merge 1 commit into
Conversation
The test claims that setting the default metrics mode explicitly makes every column keep metrics, bypassing the max-inferred-column limit. It did not check that. Lower bounds were read from dataFile.upperBounds(), so lowerBounds() was never called, and the loop variable was unused because both assertions were hardcoded to get(1). The test only checked column 1, 101 times, and stayed green even if the other 100 columns lost their metrics. Read lower bounds from lowerBounds(), assert both maps hold all columns, and use the loop variable so every column is checked. IDs start at 1 because the table reassigns them, matching testMaxColumns. Generated-by: Claude Code
thswlsqls
marked this pull request as draft
July 17, 2026 11:16
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.
Closes #17268
Summary
testMaxColumnsWithDefaultOverrideclaims that setting the default metrics mode explicitly bypasses the max-inferred-column limit, so all 101 columns keep metrics. It never checked that.dataFile.upperBounds(), solowerBounds()was never called.get(1), so only column 1 was checked, 101 times. The other 100 could lose metrics and the test would stay green.Fix: read lower bounds from
lowerBounds(), assert both maps hold every column, and use the loop variable. IDs start at 1 because the table reassigns them, as in the siblingtestMaxColumns. The size assertion mirrorstestMaxColumnsBounded.Test-only; unchanged since #3959.
Testing done
TestWriterMetricsis abstract with no subclass indata/, so:iceberg-data:testnever runs it. Verified through two of its six subclasses, covering ORC and Parquet:-DflinkVersions=1.20 :iceberg-flink:iceberg-flink-1.20:test --tests "*TestFlinkWriterMetrics"— 12 tests, 0 failures.:iceberg-spark:iceberg-spark-4.1_2.13:test --tests "*TestSparkWriterMetrics"— 12 tests, 0 failures.:iceberg-data:spotlessCheck— passed.Suppressing the bypass in
MetricsConfig.from()makes the new assertions fail (Expected size: 101 but was: 100); the old ones passed. That edit was reverted.