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


##########
datafusion/physical-plan/src/aggregates/aggregate_hash_table/common.rs:
##########
@@ -31,19 +31,31 @@ use crate::aggregates::group_values::{GroupByMetrics, 
GroupValues, new_group_val
 use crate::aggregates::order::GroupOrdering;
 use crate::aggregates::row_hash::create_group_accumulator;
 use crate::aggregates::{
-    AggregateExec, PhysicalGroupBy, aggregate_expressions, evaluate_group_by,
+    AggregateExec, AggregateMode, PhysicalGroupBy, aggregate_expressions,
+    evaluate_group_by, group_id_array, max_duplicate_ordinal,
 };
 
-/// Marker for raw rows -> partial state aggregation.
+/// Semantic mode for the aggregate hash table.
+///
+/// See [`AggregateHashTable`] comment's 'Mode' section for details.
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
+pub(in crate::aggregates) enum AggregateTableMode {
+    /// Raw rows -> partial aggregate state rows.
+    Partial,
+    /// Partial aggregate state rows -> final aggregate value rows.
+    Final,
+    /// Partial aggregate state rows -> merged partial aggregate state rows.
+    PartialReduce,
+    /// Raw rows -> final aggregate value rows.
+    Single,
+}
+
+/// Marker for ordered raw rows -> partial state aggregation.
 pub(in crate::aggregates) struct PartialMarker;

Review Comment:
   Yes, this can be done similarly.
   
   But I think there is a better fast path to implement for fully ordered case 
(query `group by a,b`, input order `order by a,b`), this idea can be 
implemented in a completely separated path without depending on the aggregate 
hash tables; while the partially ordered case still relies on hash table, and 
only do early emit optimization.
   
   So I think probably its easier to do after we have further optimized the 
full order fast path.
   
   Filed https://github.com/apache/datafusion/issues/23318 to track.



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