You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/06/15 12:14:34 UTC

[GitHub] [flink] wuchong commented on a diff in pull request #19851: [FLINK-20765][table-planner]The nullability of result for boolean expression in ScalarOperatorGens should be compatible with the return type inferred of the function in FlinkSqlOperatorTable

wuchong commented on code in PR #19851:
URL: https://github.com/apache/flink/pull/19851#discussion_r897890233


##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/expressions/utils/ScalarOperatorsTestBase.scala:
##########
@@ -67,8 +67,8 @@ abstract class ScalarOperatorsTestBase extends ExpressionTestBase {
       DataTypes.FIELD("f8", DataTypes.INT()),
       DataTypes.FIELD("f9", DataTypes.INT()),
       DataTypes.FIELD("f10", DataTypes.STRING()),
-      DataTypes.FIELD("f11", DataTypes.BOOLEAN()),
-      DataTypes.FIELD("f12", DataTypes.BOOLEAN()),
+      DataTypes.FIELD("f11", DataTypes.BOOLEAN().notNull()),
+      DataTypes.FIELD("f12", DataTypes.BOOLEAN().notNull()),

Review Comment:
   f12 = null, but why declared not null?



##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/codegen/calls/ScalarOperatorGens.scala:
##########
@@ -351,9 +351,11 @@ object ScalarOperatorGens {
     checkImplicitConversionValidity(left, right)
     val canEqual = isInteroperable(left.resultType, right.resultType)
     if (isCharacterString(left.resultType) && isCharacterString(right.resultType)) {
-      generateOperatorIfNotNull(ctx, new BooleanType(), left, right) {
-        (leftTerm, rightTerm) => s"$leftTerm.equals($rightTerm)"
-      }
+      generateOperatorIfNotNull(
+        ctx,
+        new BooleanType(left.resultType.isNullable || right.resultType.isNullable),

Review Comment:
   I think it would be more accurate to pass in resultType. Inferring type twice is hard to guarantee the type inferring is the same. 



-- 
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: issues-unsubscribe@flink.apache.org

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