docete commented on a change in pull request #9331: 
[FLINK-13523][table-planner-blink] Verify and correct arithmetic function's 
semantic for Blink planner
URL: https://github.com/apache/flink/pull/9331#discussion_r311830391
 
 

 ##########
 File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/plan/rules/logical/SplitAggregateRule.scala
 ##########
 @@ -303,7 +304,19 @@ class SplitAggregateRule extends RelOptRule(
             aggGroupCount + index + avgAggCount + 1,
             finalAggregate.getRowType)
           avgAggCount += 1
-          relBuilder.call(FlinkSqlOperatorTable.DIVIDE, sumInputRef, 
countInputRef)
+          // TODO
+          val equals = relBuilder.call(
+            FlinkSqlOperatorTable.EQUALS,
+            countInputRef,
+            relBuilder.getRexBuilder.makeBigintLiteral(JBigDecimal.valueOf(0)))
+          val falseT = relBuilder.call(FlinkSqlOperatorTable.DIVIDE, 
sumInputRef, countInputRef)
+          val trueT = relBuilder.cast(
+            relBuilder.getRexBuilder.constantNull(), 
aggCall.`type`.getSqlTypeName)
+          relBuilder.call(
+            FlinkSqlOperatorTable.IF,
 
 Review comment:
   In SQL 2013 Part 2 Section 6.27:
   The dyadic arithmetic operators <plus sign>, <minus sign>, <asterisk>, and 
<solidus> (+, –, *, and /,
   respectively) specify addition, subtraction, multiplication, and division, 
respectively. **If the value of a
   divisor is zero, then an exception condition is raised: data exception — 
division by zero.**
   
   And I think it's THE SplitAggretateRule owns the responsibility of return 
null(not throw exception). 

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to