2010YOUY01 commented on code in PR #25696:
URL: https://github.com/apache/datafusion/pull/25696#discussion_r4152886322


##########
datafusion/physical-plan/src/aggregates/mod.rs:
##########
@@ -901,6 +927,202 @@ pub struct AggregateExec {
 }
 
 impl AggregateExec {
+    /// Try to use TopK (min/max heap) optimization in AggregateExec.
+    ///
+    /// If applicable, an inner `AggregateKind` will be set, and later 
[`ExecutionPlan::execute`]

Review Comment:
   This API seems impossible to use it correctly. The updated 
`try_optimize_topk` API makes the mutation itself atomic and safe, but it still 
has preconditions on the surrounding plan shape. (In this case, the parent 
`Limit` operator must remain in the plan.)
   
   For that reason, I would prefer to stay conservative and keep the 
replacement API internal for now. Since this change is part of a deprecation, 
we can revisit it easily.
   
   How about leave a note like:
   
   > The replacement API is [`try_optimize_topk`]. It still requires specific 
plan-shape invariants to be used correctly, so it remains internal for now. If 
you have a use case that requires this API to be public, please open an issue 
in DataFusion.
   



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