Skip to content

ORC: Fix garbled exception message for invalid timestamp unit attribute#17098

Open
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/orc-timestamp-unit-exception-message
Open

ORC: Fix garbled exception message for invalid timestamp unit attribute#17098
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/orc-timestamp-unit-exception-message

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Closes #17097

Summary

  • OrcToIcebergVisitor.primitive() built the exception for an invalid iceberg.timestamp-unit attribute with "Invalid Timestamp type unit: %s" + unit (string concatenation) instead of String.format, so %s was never substituted and stayed in the message, e.g. Invalid Timestamp type unit: %sSECONDS.
  • Both the TIMESTAMP and TIMESTAMP_INSTANT branches had the same bug; this fixes both.
  • Matches the sibling pattern in GenericOrcReader.java, which already uses String.format("Invalid iceberg type %s corresponding to ORC type %s", ...) for a similar invalid-type exception.

Testing done

  • Added TestORCSchemaUtil#testInvalidTimestampUnit and #testInvalidTimestampInstantUnit, each asserting IllegalStateException with the correctly substituted message when iceberg.timestamp-unit is 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).

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
@github-actions github-actions Bot added the ORC label Jul 4, 2026
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.

ORC: Fix garbled exception message for invalid timestamp unit attribute

2 participants