thswlsqls opened a new issue, #17097:
URL: https://github.com/apache/iceberg/issues/17097

   **Apache Iceberg version**
   main @ 3038fde68
   
   **Query engine**
   N/A — engine-agnostic (ORC file format module)
   
   **Please describe the bug**
   `OrcToIcebergVisitor.primitive()` 
(`orc/src/main/java/org/apache/iceberg/orc/OrcToIcebergVisitor.java` lines 175 
and 186) builds the exception message for an unrecognized 
`iceberg.timestamp-unit` attribute by concatenating `"Invalid Timestamp type 
unit: %s" + unit` instead of calling `String.format`. The `%s` is never 
substituted and stays in the message literally, e.g. `"Invalid Timestamp type 
unit: %sSECONDS"`. Both the `TIMESTAMP` and `TIMESTAMP_INSTANT` branches have 
the same bug.
   
   Sibling code in the same module already does this correctly: 
`GenericOrcReader.java` 
(`orc/src/main/java/org/apache/iceberg/data/orc/GenericOrcReader.java` lines 
128-131) uses `String.format("Invalid iceberg type %s corresponding to ORC type 
%s", iPrimitive, primitive)`.
   
   **Steps to reproduce**
   Convert an ORC `TypeDescription` whose `TIMESTAMP` (or `TIMESTAMP_INSTANT`) 
column has the `iceberg.timestamp-unit` attribute set to a value other than 
`MICROS`/`NANOS` (e.g. `SECONDS`), via `ORCSchemaUtil.convert(TypeDescription)`.
   
   Expected: `IllegalStateException` with message `Invalid Timestamp type unit: 
SECONDS`.
   Actual: `IllegalStateException` with message `Invalid Timestamp type unit: 
%sSECONDS`.
   
   This is reachable through the normal file-reading path: 
`ORCSchemaUtil.convert(TypeDescription)` → `OrcMetrics.buildOrcMetrics` → 
`OrcMetrics.fromInputFile`, used when reading ORC files written by other tools 
or containing unexpected attribute values.
   
   **Additional context**
   N/A — covered above.
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to