lowka commented on code in PR #1623:
URL: https://github.com/apache/ignite-3/pull/1623#discussion_r1102629592


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/exec/exp/RexToLixTranslator.java:
##########
@@ -214,7 +218,18 @@ Expression translateCast(
         Expression convert = null;
         switch (targetType.getSqlTypeName()) {
             case ANY:
-                convert = operand;
+                // IgniteCustomType: conversion from some type to possibly a 
custom data type.
+                // Should we add a hook here that can short-circuit when a 
custom type can not be converted?
+                if (targetType instanceof UuidType) {
+                    // We need to convert an argument to an object so a call 
will throw a CastCastException
+                    // instead of a NoSuchMethodError in runtime.
+                    // It would be even better if this cast were not be 
necessary.
+                    return Expressions.call(UuidFunctions.class, "cast", 
Expressions.convert_(operand, Object.class));

Review Comment:
   I can introduce UuidFunctions.CAST (static field) and replace 
`Expressions.call(UuidFunctions.class, "cast", operand_expression)` with 
Expressions.call(UuidFunctions.CAST, operand_expression). I think it is better 
to keep explicit code here - we want to build a cast expression with such and 
such operand. 



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

Reply via email to