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


##########
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;
+        // IgniteCustomType: If type1 is a custom data type that can be 
converted to type2,

Review Comment:
   Thanks. I would rewrite this comment and this method.



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