Skip to content

Data: Fix bounds assertions in testMaxColumnsWithDefaultOverride#17269

Draft
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/data-writer-metrics-bounds-assertions
Draft

Data: Fix bounds assertions in testMaxColumnsWithDefaultOverride#17269
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/data-writer-metrics-bounds-assertions

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Closes #17268

Summary

testMaxColumnsWithDefaultOverride claims that setting the default metrics mode explicitly bypasses the max-inferred-column limit, so all 101 columns keep metrics. It never checked that.

  • Lower bounds were read from dataFile.upperBounds(), so lowerBounds() was never called.
  • The loop variable was unused: both assertions hardcoded 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 sibling testMaxColumns. The size assertion mirrors testMaxColumnsBounded.

Test-only; unchanged since #3959.

Testing done

TestWriterMetrics is abstract with no subclass in data/, so :iceberg-data:test never 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.

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
@github-actions github-actions Bot added the data label Jul 17, 2026
@thswlsqls
thswlsqls marked this pull request as draft July 17, 2026 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data: TestWriterMetrics.testMaxColumnsWithDefaultOverride does not verify bounds

1 participant