haohuaijin commented on PR #8124: URL: https://github.com/apache/arrow-datafusion/pull/8124#issuecomment-1806987015
@jonahgao thanks for your provider this case. I didn't read the source code of calcite carefully. I think implement `SqlSumEmptyIsZero` in datafusion is easy, we can add flag to [`Sum`](https://github.com/apache/arrow-datafusion/blob/e642cc2a94f38518d765d25c8113523aedc29198/datafusion/physical-expr/src/aggregate/sum.rs#L42-L47) and init [`SumAccumulator`](https://github.com/apache/arrow-datafusion/blob/e642cc2a94f38518d765d25c8113523aedc29198/datafusion/physical-expr/src/aggregate/sum.rs#L180-L187) to 0, and add a `AggregateFunction` about `SqlSumEmptyIsZero`. Here is a link about [`Sum0`](https://javadoc.io/static/org.apache.calcite/calcite-core/1.21.0/org/apache/calcite/sql/fun/SqlSumEmptyIsZeroAggFunction.html) in calcite. I have no preference between the two methods, what do you think @alamb ? -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
