wuchong 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_r311580186
########## 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: I agree with @JingsongLi , we should never throw exception in blink planner. `null or zero / zero` should always return null, in that way, we can avoid to introduce this. ---------------------------------------------------------------- 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