Shekharrajak opened a new pull request, #2994:
URL: https://github.com/apache/datafusion-comet/pull/2994

   ## Which issue does this PR close?
   
   Closes #2894
   
   ## Rationale for this change
   
   Comet currently falls back to Spark for ALL final hash aggregates when 
there's no Comet partial aggregate in the child plan. This is overly 
conservative because some aggregates have compatible intermediate buffer 
formats between Spark and Comet.
   For example, MIN, MAX, COUNT, and bitwise aggregates (BIT_AND, BIT_OR, 
BIT_XOR) have simple intermediate buffers (single value) that are compatible 
between Spark and Comet. These can safely run with "Spark partial / Comet 
final" execution.
   Other aggregates like SUM, AVG, VARIANCE, etc. have known incompatibilities 
(e.g., decimal overflow handling differences, complex intermediate buffers) and 
should continue to fall back when there's no Comet partial aggregate.
   ## What changes are included in this PR?
   
   Added supportsSparkPartialCometFinal method to CometAggregateExpressionSerde 
trait - Default is false
   
   Added helper function - aggSupportsMixedExecution() in QueryPlanSerde
   
   ## How are these changes tested?
   
   "CometExecRule should not allow Spark partial and Comet final for unsafe 
aggregates" - Verifies SUM still falls back to Spark
   
   "CometExecRule should allow Spark partial and Comet final for safe 
aggregates" - Verifies MIN/MAX/COUNT can use Comet final with Spark partial
   


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