aihuaxu commented on code in PR #13195:
URL: https://github.com/apache/iceberg/pull/13195#discussion_r2216557339


##########
api/src/main/java/org/apache/iceberg/expressions/VariantExpressionUtil.java:
##########
@@ -111,8 +113,19 @@ static <T> T castTo(VariantValue value, Type type) {
         }
 
         break;
-    }
+      case TIMESTAMP:
+      case TIMESTAMP_NANO:
+      case TIME:
+        if (value.type() == PhysicalType.INT64) {
+          return (T) (Long) ((Number) value.asPrimitive().get()).longValue();
+        }
 
+        break;
+      case UUID:

Review Comment:
   UUID has its own type in Variant (see 
https://github.com/apache/parquet-format/blob/master/VariantEncoding.md) not 
stored in string. If the value is UUID in Variant, then it should be read 
properly as UUID. 
   
   I checked a little more. Seems we should support `extract("variant", 
"$.event_uuid", "string")` in addition to `extract("variant", "$.event_uuid", 
"UUID")` so we can read UUID back as string. 
   
   The followings should be supported:
   
   ```
   lessThan(extract("variant", "$.event_uuid", "string"), VAR_UUID)
   lessThan(extract("variant", "$.event_uuid", "string"), "abc")
   lessThan(extract("variant", "$.event_uuid", "uuid"), VAR_UUID)
   lessThan(extract("variant", "$.event_uuid", "uuid"), 
"6b7ac0a2-3d71-4f06-ae61-a59ab6a7b954") 
   ```
    
   
   
   
   



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