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


##########
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:
   If you look at the code more carefully one part does not issue a cast to an 
object. And that's a huge distinction.



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