chunweilei commented on code in PR #2855:
URL: https://github.com/apache/calcite/pull/2855#discussion_r922932458


##########
core/src/main/java/org/apache/calcite/sql/validate/implicit/AbstractTypeCoercion.java:
##########
@@ -436,11 +436,13 @@ private RelDataType getTightestCommonTypeOrThrow(
     // 2. VARCHAR has 65536 as default precision.
     // 3. Following MS-SQL: BINARY or BOOLEAN can be casted to VARCHAR.
     if (SqlTypeUtil.isAtomic(type1) && SqlTypeUtil.isCharacter(type2)) {
-      resultType = factory.createSqlType(SqlTypeName.VARCHAR);
+      resultType = 
factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR),
+          type1.isNullable() || type2.isNullable());
     }
 
     if (SqlTypeUtil.isCharacter(type1) && SqlTypeUtil.isAtomic(type2)) {
-      resultType = factory.createSqlType(SqlTypeName.VARCHAR);
+      resultType = 
factory.createTypeWithNullability(factory.createSqlType(SqlTypeName.VARCHAR),
+          type1.isNullable() || type2.isNullable());
     }

Review Comment:
   Do other kinds of conversions have the same issue?



-- 
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: commits-unsubscr...@calcite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to