sunchao commented on PR #57576:
URL: https://github.com/apache/spark/pull/57576#issuecomment-5153791439

   Thanks @peter-toth for catching the aggregate expression-ID collision. 
`a04260d9` fixes it by assigning every fused array aggregate a fresh 
`resultId`, with a regression covering the CTE self-join that previously threw 
`ClassCastException`.
   
   I also added an explicit feature flag in `8a3f7809`:
   
   ```sql
   SET spark.sql.optimizer.combineApproximatePercentiles.enabled = true;
   ```
   
   The flag defaults to **false**, so existing Spark workloads and query plans 
remain unchanged unless the optimization is explicitly enabled. When enabled, 
compatible scalar approximate percentiles share one sketch while retaining the 
existing collision guards, exchange/subquery-reuse safeguards, fresh aggregate 
IDs, and streaming/checkpoint protections. Catalyst and SQL regressions cover 
both disabled and enabled behavior.


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