twalthr commented on a change in pull request #7079: [FLINK-10845][table] 
Support multiple different DISTINCT aggregates for batch
URL: https://github.com/apache/flink/pull/7079#discussion_r238731972
 
 

 ##########
 File path: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/codegen/calls/ScalarOperators.scala
 ##########
 @@ -191,7 +191,17 @@ object ScalarOperators {
           )
         )
     }
-  }  
+  }
+
+  def generateDistinctFrom(
+      nullCheck: Boolean,
+      left: GeneratedExpression,
+      right: GeneratedExpression)
+    : GeneratedExpression = {
+    val newleft = left.copy(nullTerm = GeneratedExpression.NEVER_NULL)
 
 Review comment:
   @xueyumusic You can also do it like this (pseudo code):
   ```
   ${left.code}
   ${right.code}
   resultTerm;
   if (${left.nullTerm}) {
     resultTerm = ${right.nullTerm}
   } else if (${right.nullTerm}) {
     resultTerm = ${left.nullTerm}
   } else {
     resultTerm = generateEqual(
       false, // no null check required in equals
       ${left.copy(code = NO_CODE)},
       ${right.copy(code = NO_CODE)})
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to