NobiGo commented on code in PR #4006:
URL: https://github.com/apache/calcite/pull/4006#discussion_r1805681285


##########
core/src/main/java/org/apache/calcite/sql/validate/implicit/AbstractTypeCoercion.java:
##########
@@ -502,6 +502,11 @@ private RelDataType getTightestCommonTypeOrThrow(
       return null;
     }
 
+    if (type1 instanceof RelDataTypeFactoryImpl.JavaType

Review Comment:
   @mihaibudiu 
   Hi, I found this problem in the 
ReflectiveSchemaTest#testCompareJavaAndSqlTypes.
   Now in the condition `primitiveLong > 0`, the primitiveLong will be cast to 
RelDataType.INTEGER. This will cause value overflow(Now don't, because we don't 
add CAST in primitiveLong).
   According to AbstractTypeCoercion,#needToCast prevents casting a JavaType to 
a normal RelDataType, so we don't need support to convert it.
   Before CALCITE-6617, the ReflectiveSchemaTest#testCompareJavaAndSqlTypes 
returned `null` when comparing a Java type with an SQL type INTEGER.
   Now the ReflectiveSchemaTest#testCompareJavaAndSqlTypes can't handle it when 
the input is Java type and Java type. Because no exception was thrown in the 
unit test, So I don't support it now.
   



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