kgyrtkirk commented on a change in pull request #2360:
URL: https://github.com/apache/hive/pull/2360#discussion_r666359063
##########
File path: ql/src/java/org/apache/hadoop/hive/ql/optimizer/StatsOptimizer.java
##########
@@ -397,6 +397,11 @@ else if (getGbyKeyType(cgbyOp) == GbyKeyType.CONSTANT &&
rowCnt == 0) {
if (udaf instanceof GenericUDAFSum) {
// long/double/decimal
ExprNodeDesc desc = aggr.getParameters().get(0);
+ // add null for SUM(1), when the table is empty. Without this,
category = LONG, and the result is 0
+ // instead of NULL.
+ if (desc instanceof ExprNodeConstantDesc && rowCnt == 0) {
+ oneRow.add(null);
+ }
Review comment:
down below it will add a second value to the row (`oneRow`) ; try a test
with multiple sum-s like 2
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]