Skip to content

Add a test for out-of-range enums in Iceberg manifest files - #116318

Merged
alexey-milovidov merged 2 commits into
masterfrom
iceberg-malformed-enum-tests
Aug 27, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
iceberg-malformed-enum-tests

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 25, 2026 •

Copy link
Copy Markdown
Member

Related: #115703

Changelog category (leave one):

  • Not for changelog (changelog entry is not required)

Regression coverage for the Iceberg part of #115703, requested in the review there: reading a table whose metadata contains an out-of-range enum-like integer must throw ICEBERG_SPECIFICATION_VIOLATION instead of casting the unchecked value to a C++ enum, which is undefined behaviour. The test covers all three validated fields:

  • an out-of-range status of a manifest entry,
  • an out-of-range data_file.content of a manifest entry,
  • an out-of-range and a negative content of a manifest list entry.

The test creates a well-formed Iceberg table with the IcebergLocal engine and rewrites a single enum value of the Avro metadata in place: the files are written with the null codec, so a schema-driven walk over the first record finds the byte offset of the field with no third-party Avro library (the stateless CI image has no avro/fastavro). If any of the range checks from #115703 is removed again, the corresponding case stops throwing and the test fails.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/116318]

Regression test for the Iceberg part of #115703: an out-of-range `status` or
`data_file.content` of a manifest entry and an out-of-range (or negative)
`content` of a manifest list entry must throw `ICEBERG_SPECIFICATION_VIOLATION`
instead of casting the unchecked value to a C++ enum. The test creates a
well-formed table with the `IcebergLocal` engine and rewrites a single enum
value in place: the Avro metadata files are written with the null codec, so a
schema-driven walk over the first record finds the field without a third-party
Avro library.

Co-Authored-By: Claude Fable 5 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [23fc8fc]

Summary: ✅


AI Review

Summary

This PR adds a focused stateless regression test for malformed enum-like integers in Iceberg manifest metadata, covering both out-of-range and negative values for the validated manifest-entry and manifest-list fields. The current version addresses the earlier review concerns by tying each case to the intended diagnostic and by adding negative-value coverage, and I did not find a remaining correctness or test-contract issue in the patch.

Final Verdict

✅ No remaining findings.

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Aug 25, 2026
…anifest-entry enums

Two changes requested in the review:
- \`check_throws\` now also matches the field-specific error message, so the test
  stays tied to the intended range check even if the Avro patching ever starts
  corrupting a different field.
- Added negative (\`-1\`) cases for the \`status\` and \`data_file.content\` of a
  manifest entry. Their expected fragments do not pin the reported value: today
  a negative value surfaces via the \`safeGet\` unsigned conversion as a huge
  number, and the rendering may change while the rejection itself must stay.

Co-Authored-By: Claude Fable 5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 The Stress test (arm_msan) failure is unrelated to this test-only PR: the server could not restart because of an Alias → Alias table chain left by the stress run (Alias table cannot refer to another Alias table at ATTACH). It is tracked in #116207 and the fix is in progress in #116153.

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 27, 2026
Merged via the queue into master with commit 5c5281a Aug 27, 2026
179 checks passed
@alexey-milovidov
alexey-milovidov deleted the iceberg-malformed-enum-tests branch August 27, 2026 22:11
@robot-clickhouse-ci-1 robot-clickhouse-ci-1 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-not-for-changelog This PR should not be mentioned in the changelog pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants