Repository navigation
Conversation
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.
Which issue does this PR close?
Closes #7442.
Rationale for this change
At integer
truncatewidths above 2^30, Iceberg Java's(v % W) + Woverflows a 32-bitint, while the format spec and iceberg-rust computev - (v % W). Every Iceberg release through 1.12.0 overflows, and a release carrying apache/iceberg#18112 returns the spec value, so the expected answer depends on the Iceberg jar the user runs. Comet cannot choose from the Spark profile, because users pick their Iceberg runtime independently.What changes are included in this PR?
CometIcebergTruncatedeclines an integertruncate[W]withW > 2^30fortinyint,smallint,intanddate, so Spark evaluates the call with the user's jar. Long, string and binary truncation stays native:truncateLonguses long arithmetic andWis anint, so it cannot overflow at these widths.truncate[W]field above that width. The native writer would write the spec value while the user's jar writes the overflowed one into the same table.i32::MIN/i64::MINas the iceberg-rust cases.getUnsupportedReasonslists it.How are these changes tested?
2^30and above forint, and forlongat the same width.truncate(2000000000, i32), and keepsInt.MaxValuecoverage forlongandstring.truncate(2000000000, id)partition spec (fall-back) and for the maximum safe width (Compatible).