edgarRd commented on code in PR #17157:
URL: https://github.com/apache/iceberg/pull/17157#discussion_r3985440018


##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetConversions.java:
##########
@@ -94,6 +94,12 @@ static Function<Object, Object> 
converterFromParquet(PrimitiveType type) {
     if (type.getOriginalType() != null) {
       switch (type.getOriginalType()) {
         case UTF8:
+        case ENUM:
+        case JSON:
+          // ENUM and JSON are UTF-8 strings that map to Iceberg StringType 
(see MessageTypeToType),
+          // so they must be decoded to a CharSequence like UTF8; otherwise 
read-time row-group
+          // filters compare a ByteBuffer against a CharSequence literal and 
throw
+          // ClassCastException

Review Comment:
   With the new included end-to-end (`creation → metadata reading → row-group 
filtering`) test, I verified that removing the `ENUM`/`JSON` conversion fix 
makes both parameterized cases throw the original `ClassCastException` in 
`Comparators.CharSeqComparator.compare(...)`.
   
   It does not exercise a full table import, SQL query, or row materialization 
given that the original end-to-end way that I found the issue was with and 
older version of Flink-generated files writing directly to S3 - any other 
existing writer in Iceberg (at a higher level) would not hit this issue.



-- 
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