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


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

Review Comment:
   Currently, we are supporting INT64 to those types. How about other 
conversions from INT8/INT16/INT32? Also how about TIMESTAMP =>  TIMESTAMP_NANO 
and also TIME => TIMESTAMP / TIMESTAMP_NANO? 
   
   cc @RussellSpitzer and @rdblue  I think we need to handle such conversions? 



##########
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:
   This is to cast string to UUID. If the string is not UUID, then currently we 
would fail in the following `UUID.fromString()` but I think we should not 
expect the filtering like `uuid = 'abc'` to fail.
   



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