okumin commented on PR #5091:
URL: https://github.com/apache/hive/pull/5091#issuecomment-2106461940

   @kasakrisz Thanks. I found `cbo_rp_groupby3_noskew_multi_distinct.q` fails 
and it turned out the root cause is not HiveAggregateReduceFunctionsRule but 
CBO Return Path + non-map-side aggregation. We may check the problem first.
   
   https://github.com/apache/hive/pull/5245
   
   > Add an explicit cast in case the parameter of the aggregates mentioned has 
type from the character family to make sure that count only counts values which 
can be converted to a numeric type.
   
   My PoC is here. We need #5245 .
   
https://github.com/apache/hive/pull/5091/commits/da7507d3caa2150d8282412f801b8e9854aef293
   
   > as you mentioned: "I believe SUM should return NULL if all rows are 
evaluated as NULL" on both CBO and non-CBO path.
   > Swapping these lines may help to solve this:
   
   I believe you mentioned how to correct the following semantics. I will try. 
Can I resolve it in this ticket? Literally, `SUM` is not a member accelerated 
by HiveAggregateReduceFunctionsRule. And if we add an explicit cast, at least 
all problems related to HiveAggregateReduceFunctionsRule will likely be gone. 
It is up to your convenience.
   
   | | CBO | Non-CBO | Note |
   |-|-|-|-|
   | SUM(c_non_numeric) | 0.0 | 0.0 | |
   | SUM(CAST(c_non_numeric AS DOUBLE)) | NULL | NULL | |


-- 
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]

Reply via email to