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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteTypeCoercion.java:
##########
@@ -291,6 +291,33 @@ private RelDataType syncAttributes(
         return syncedType;
     }
 
+    /** {@inheritDoc} **/
+    @Override
+    public @Nullable RelDataType commonTypeForBinaryComparison(@Nullable 
RelDataType type1, @Nullable RelDataType type2) {
+        if (type1 == null || type2 == null) {
+            return null;
+        }
+
+        if (type1 instanceof IgniteCustomType) {
+            return tryCustomTypeCoercionRules(type1, type2);
+        } else if (type2 instanceof IgniteCustomType) {
+            return tryCustomTypeCoercionRules(type2, type1);
+        } else {
+            return super.commonTypeForBinaryComparison(type1, type2);
+        }
+    }
+
+    private @Nullable RelDataType tryCustomTypeCoercionRules(RelDataType 
type1, RelDataType type2) {
+        IgniteCustomType to = (IgniteCustomType) type1;

Review Comment:
   Yep. I also didn't like the way I wrote but I was not sure.



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