jayzhan211 commented on code in PR #15022:
URL: https://github.com/apache/datafusion/pull/15022#discussion_r1988229738


##########
datafusion/expr-common/src/groups_accumulator.rs:
##########
@@ -251,3 +261,18 @@ pub trait GroupsAccumulator: Send {
     /// compute, not `O(num_groups)`
     fn size(&self) -> usize;
 }
+
+/// Metadata for [`GroupsAccumulator`] with some execution time information so 
you can optimize your implementation.
+#[derive(Debug, Clone, PartialEq)]
+pub struct GroupsAccumulatorMetadata {
+    /// Whether each group is contiguous, this will be `true`
+    ///
+    /// Meaning that if you get the following group indices in 
[`GroupsAccumulator::update_batch`]/[`GroupsAccumulator::merge_batch`]
+    /// ```text
+    /// [1, 1, 1, 1, 1, 2, 2, 3]
+    /// ```
+    ///
+    /// You can be sure that you will never get another group with index 1 or 
2 (until call to [`GroupsAccumulator::state`]/[`GroupsAccumulator::evaluate`] 
which will shift the group indices).
+    /// However, you might get another group with index 3 in the future.
+    pub contiguous_group_indices: bool,

Review Comment:
   What is the difference with InputOrderMode::Sorted? Is it possible to update 
`InputOrderMode` to `InputOrderMode::Sorted` if sorted is found



-- 
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: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to