Skip to content

Data: Fix bounds assertions in testMaxColumnsWithDefaultOverride - #17269

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

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

@thswlsqls thswlsqls commented Jul 17, 2026

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.


AI Disclosure

  • Tool: Claude Code — used to analyze the code and fix the test.

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
@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale due to 30 days of inactivity. It will be closed in 1 week if no further activity occurs. If you think that’s incorrect or this pull request requires a review, please simply write any comment. If closed, you can revive the PR at any time and @mention a reviewer or discuss it on the dev@iceberg.apache.org list. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Aug 22, 2026
@github-actions

Copy link
Copy Markdown

This pull request has been closed due to lack of activity. This is not a judgement on the merit of the PR in any way. It is just a way of keeping the PR queue manageable. If you think that is incorrect, or the pull request requires review, you can revive the PR at any time.

@github-actions github-actions Bot closed this Aug 29, 2026
@thswlsqls
thswlsqls deleted the fix/data-writer-metrics-bounds-assertions branch September 9, 2026 23:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Data: TestWriterMetrics.testMaxColumnsWithDefaultOverride does not verify bounds

1 participant