ORC: Fix garbled exception message for invalid timestamp unit attribute#17098
Open
thswlsqls wants to merge 1 commit into
Open
ORC: Fix garbled exception message for invalid timestamp unit attribute#17098thswlsqls wants to merge 1 commit into
thswlsqls wants to merge 1 commit into
Conversation
OrcToIcebergVisitor.primitive() built the exception message for an unrecognized iceberg.timestamp-unit attribute value by concatenating "%s" with the raw string (+) instead of calling String.format, so the literal "%s" was never substituted and stayed in the thrown message. Both the TIMESTAMP and TIMESTAMP_INSTANT branches had the same bug. Switch both to String.format, matching the sibling pattern already used in GenericOrcReader for similar "invalid type" exceptions. Generated-by: Claude Code
ebyhr
approved these changes
Jul 5, 2026
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 #17097
Summary
OrcToIcebergVisitor.primitive()built the exception for an invalidiceberg.timestamp-unitattribute with"Invalid Timestamp type unit: %s" + unit(string concatenation) instead ofString.format, so%swas never substituted and stayed in the message, e.g.Invalid Timestamp type unit: %sSECONDS.TIMESTAMPandTIMESTAMP_INSTANTbranches had the same bug; this fixes both.GenericOrcReader.java, which already usesString.format("Invalid iceberg type %s corresponding to ORC type %s", ...)for a similar invalid-type exception.Testing done
TestORCSchemaUtil#testInvalidTimestampUnitand#testInvalidTimestampInstantUnit, each assertingIllegalStateExceptionwith the correctly substituted message wheniceberg.timestamp-unitis set to an unsupported value../gradlew :iceberg-orc:check— 10 tests passed (TestORCSchemaUtil), including the 2 new tests../gradlew :iceberg-orc:revapi— passed as part of:iceberg-orc:check(package-private class, no public API impact).