File tree 2 files changed +52
-0
lines changed
physical-plan/src/aggregates/group_values
2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -250,4 +250,30 @@ pub trait GroupsAccumulator: Send {
250
250
/// This function is called once per batch, so it should be `O(n)` to
251
251
/// compute, not `O(num_groups)`
252
252
fn size ( & self ) -> usize ;
253
+
254
+ /// Returns `true` if this accumulator supports blocked groups.
255
+ fn supports_blocked_groups ( & self ) -> bool {
256
+ false
257
+ }
258
+
259
+ /// Alter the block size in the accumulator
260
+ ///
261
+ /// If the target block size is `None`, it will use a single big
262
+ /// block(can think it a `Vec`) to manage the state.
263
+ ///
264
+ /// If the target block size` is `Some(blk_size)`, it will try to
265
+ /// set the block size to `blk_size`, and the try will only success
266
+ /// when the accumulator has supported blocked mode.
267
+ ///
268
+ /// NOTICE: After altering block size, all data in previous will be cleared.
269
+ ///
270
+ fn alter_block_size ( & mut self , block_size : Option < usize > ) -> Result < ( ) > {
271
+ if block_size. is_some ( ) {
272
+ return Err ( DataFusionError :: NotImplemented (
273
+ "this accumulator doesn't support blocked mode yet" . to_string ( ) ,
274
+ ) ) ;
275
+ }
276
+
277
+ Ok ( ( ) )
278
+ }
253
279
}
Original file line number Diff line number Diff line change @@ -110,6 +110,32 @@ pub(crate) trait GroupValues: Send {
110
110
111
111
/// Clear the contents and shrink the capacity to the size of the batch (free up memory usage)
112
112
fn clear_shrink ( & mut self , batch : & RecordBatch ) ;
113
+
114
+ /// Returns `true` if this accumulator supports blocked groups.
115
+ fn supports_blocked_groups ( & self ) -> bool {
116
+ false
117
+ }
118
+
119
+ /// Alter the block size in the `group values`
120
+ ///
121
+ /// If the target block size is `None`, it will use a single big
122
+ /// block(can think it a `Vec`) to manage the state.
123
+ ///
124
+ /// If the target block size` is `Some(blk_size)`, it will try to
125
+ /// set the block size to `blk_size`, and the try will only success
126
+ /// when the `group values` has supported blocked mode.
127
+ ///
128
+ /// NOTICE: After altering block size, all data in previous will be cleared.
129
+ ///
130
+ fn alter_block_size ( & mut self , block_size : Option < usize > ) -> Result < ( ) > {
131
+ if block_size. is_some ( ) {
132
+ return Err ( DataFusionError :: NotImplemented (
133
+ "this group values doesn't support blocked mode yet" . to_string ( ) ,
134
+ ) ) ;
135
+ }
136
+
137
+ Ok ( ( ) )
138
+ }
113
139
}
114
140
115
141
/// Return a specialized implementation of [`GroupValues`] for the given schema.
You can’t perform that action at this time.
0 commit comments