File tree Expand file tree Collapse file tree 11 files changed +31
-40
lines changed
datafusion/physical-expr/src Expand file tree Collapse file tree 11 files changed +31
-40
lines changed Original file line number Diff line number Diff line change @@ -134,10 +134,6 @@ impl AggregateExpr for Avg {
134
134
is_row_accumulator_support_dtype ( & self . sum_data_type )
135
135
}
136
136
137
- fn supports_bounded_execution ( & self ) -> bool {
138
- true
139
- }
140
-
141
137
fn create_row_accumulator (
142
138
& self ,
143
139
start_index : usize ,
@@ -263,6 +259,9 @@ impl Accumulator for AvgAccumulator {
263
259
) ) ,
264
260
}
265
261
}
262
+ fn supports_retract_batch ( & self ) -> bool {
263
+ true
264
+ }
266
265
267
266
fn size ( & self ) -> usize {
268
267
std:: mem:: size_of_val ( self ) - std:: mem:: size_of_val ( & self . sum ) + self . sum . size ( )
Original file line number Diff line number Diff line change @@ -133,10 +133,6 @@ impl AggregateExpr for Count {
133
133
true
134
134
}
135
135
136
- fn supports_bounded_execution ( & self ) -> bool {
137
- true
138
- }
139
-
140
136
fn create_row_accumulator (
141
137
& self ,
142
138
start_index : usize ,
@@ -214,6 +210,10 @@ impl Accumulator for CountAccumulator {
214
210
Ok ( ScalarValue :: Int64 ( Some ( self . count ) ) )
215
211
}
216
212
213
+ fn supports_retract_batch ( & self ) -> bool {
214
+ true
215
+ }
216
+
217
217
fn size ( & self ) -> usize {
218
218
std:: mem:: size_of_val ( self )
219
219
}
Original file line number Diff line number Diff line change @@ -125,10 +125,6 @@ impl AggregateExpr for Max {
125
125
is_row_accumulator_support_dtype ( & self . data_type )
126
126
}
127
127
128
- fn supports_bounded_execution ( & self ) -> bool {
129
- true
130
- }
131
-
132
128
fn create_row_accumulator (
133
129
& self ,
134
130
start_index : usize ,
@@ -699,6 +695,10 @@ impl Accumulator for SlidingMaxAccumulator {
699
695
Ok ( self . max . clone ( ) )
700
696
}
701
697
698
+ fn supports_retract_batch ( & self ) -> bool {
699
+ true
700
+ }
701
+
702
702
fn size ( & self ) -> usize {
703
703
std:: mem:: size_of_val ( self ) - std:: mem:: size_of_val ( & self . max ) + self . max . size ( )
704
704
}
@@ -825,10 +825,6 @@ impl AggregateExpr for Min {
825
825
is_row_accumulator_support_dtype ( & self . data_type )
826
826
}
827
827
828
- fn supports_bounded_execution ( & self ) -> bool {
829
- true
830
- }
831
-
832
828
fn create_row_accumulator (
833
829
& self ,
834
830
start_index : usize ,
@@ -958,6 +954,10 @@ impl Accumulator for SlidingMinAccumulator {
958
954
Ok ( self . min . clone ( ) )
959
955
}
960
956
957
+ fn supports_retract_batch ( & self ) -> bool {
958
+ true
959
+ }
960
+
961
961
fn size ( & self ) -> usize {
962
962
std:: mem:: size_of_val ( self ) - std:: mem:: size_of_val ( & self . min ) + self . min . size ( )
963
963
}
Original file line number Diff line number Diff line change @@ -96,12 +96,6 @@ pub trait AggregateExpr: Send + Sync + Debug + PartialEq<dyn Any> {
96
96
false
97
97
}
98
98
99
- /// Specifies whether this aggregate function can run using bounded memory.
100
- /// Any accumulator returning "true" needs to implement `retract_batch`.
101
- fn supports_bounded_execution ( & self ) -> bool {
102
- false
103
- }
104
-
105
99
/// RowAccumulator to access/update row-based aggregation state in-place.
106
100
/// Currently, row accumulator only supports states of fixed-sized type.
107
101
///
Original file line number Diff line number Diff line change @@ -131,10 +131,6 @@ impl AggregateExpr for Sum {
131
131
is_row_accumulator_support_dtype ( & self . data_type )
132
132
}
133
133
134
- fn supports_bounded_execution ( & self ) -> bool {
135
- true
136
- }
137
-
138
134
fn create_row_accumulator (
139
135
& self ,
140
136
start_index : usize ,
@@ -361,6 +357,10 @@ impl Accumulator for SumAccumulator {
361
357
}
362
358
}
363
359
360
+ fn supports_retract_batch ( & self ) -> bool {
361
+ true
362
+ }
363
+
364
364
fn size ( & self ) -> usize {
365
365
std:: mem:: size_of_val ( self ) - std:: mem:: size_of_val ( & self . sum ) + self . sum . size ( )
366
366
}
Original file line number Diff line number Diff line change @@ -155,8 +155,7 @@ impl WindowExpr for PlainAggregateWindowExpr {
155
155
}
156
156
157
157
fn uses_bounded_memory ( & self ) -> bool {
158
- self . aggregate . supports_bounded_execution ( )
159
- && !self . window_frame . end_bound . is_unbounded ( )
158
+ !self . window_frame . end_bound . is_unbounded ( )
160
159
}
161
160
}
162
161
Original file line number Diff line number Diff line change @@ -122,7 +122,7 @@ impl WindowExpr for BuiltInWindowExpr {
122
122
} else if evaluator. include_rank ( ) {
123
123
let columns = self . sort_columns ( batch) ?;
124
124
let sort_partition_points = evaluate_partition_ranges ( num_rows, & columns) ?;
125
- evaluator. evaluate_with_rank_all ( num_rows, & sort_partition_points)
125
+ evaluator. evaluate_all_with_rank ( num_rows, & sort_partition_points)
126
126
} else {
127
127
let ( values, _) = self . get_values_orderbys ( batch) ?;
128
128
evaluator. evaluate_all ( & values, num_rows)
Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ impl BuiltInWindowFunctionExpr for CumeDist {
70
70
pub ( crate ) struct CumeDistEvaluator ;
71
71
72
72
impl PartitionEvaluator for CumeDistEvaluator {
73
- fn evaluate_with_rank_all (
73
+ fn evaluate_all_with_rank (
74
74
& self ,
75
75
num_rows : usize ,
76
76
ranks_in_partition : & [ Range < usize > ] ,
@@ -109,7 +109,7 @@ mod tests {
109
109
) -> Result < ( ) > {
110
110
let result = expr
111
111
. create_evaluator ( ) ?
112
- . evaluate_with_rank_all ( num_rows, & ranks) ?;
112
+ . evaluate_all_with_rank ( num_rows, & ranks) ?;
113
113
let result = as_float64_array ( & result) ?;
114
114
let result = result. values ( ) ;
115
115
assert_eq ! ( expected, * result) ;
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ use std::ops::Range;
69
69
///
70
70
/// # Stateless `PartitionEvaluator`
71
71
///
72
- /// In this case, either [`Self::evaluate_all`] or [`Self::evaluate_with_rank_all `] is called with values for the
72
+ /// In this case, either [`Self::evaluate_all`] or [`Self::evaluate_all_with_rank `] is called with values for the
73
73
/// entire partition.
74
74
///
75
75
/// # Stateful `PartitionEvaluator`
@@ -221,7 +221,7 @@ pub trait PartitionEvaluator: Debug + Send {
221
221
) )
222
222
}
223
223
224
- /// [`PartitionEvaluator::evaluate_with_rank_all `] is called for window
224
+ /// [`PartitionEvaluator::evaluate_all_with_rank `] is called for window
225
225
/// functions that only need the rank of a row within its window
226
226
/// frame.
227
227
///
@@ -248,7 +248,7 @@ pub trait PartitionEvaluator: Debug + Send {
248
248
/// (3,4),
249
249
/// ]
250
250
/// ```
251
- fn evaluate_with_rank_all (
251
+ fn evaluate_all_with_rank (
252
252
& self ,
253
253
_num_rows : usize ,
254
254
_ranks_in_partition : & [ Range < usize > ] ,
@@ -278,7 +278,7 @@ pub trait PartitionEvaluator: Debug + Send {
278
278
279
279
/// Can this function be evaluated with (only) rank
280
280
///
281
- /// If `include_rank` is true, implement [`PartitionEvaluator::evaluate_with_rank_all `]
281
+ /// If `include_rank` is true, implement [`PartitionEvaluator::evaluate_all_with_rank `]
282
282
fn include_rank ( & self ) -> bool {
283
283
false
284
284
}
Original file line number Diff line number Diff line change @@ -159,7 +159,7 @@ impl PartitionEvaluator for RankEvaluator {
159
159
}
160
160
}
161
161
162
- fn evaluate_with_rank_all (
162
+ fn evaluate_all_with_rank (
163
163
& self ,
164
164
num_rows : usize ,
165
165
ranks_in_partition : & [ Range < usize > ] ,
@@ -236,7 +236,7 @@ mod tests {
236
236
) -> Result < ( ) > {
237
237
let result = expr
238
238
. create_evaluator ( ) ?
239
- . evaluate_with_rank_all ( num_rows, & ranks) ?;
239
+ . evaluate_all_with_rank ( num_rows, & ranks) ?;
240
240
let result = as_float64_array ( & result) ?;
241
241
let result = result. values ( ) ;
242
242
assert_eq ! ( expected, * result) ;
@@ -248,7 +248,7 @@ mod tests {
248
248
ranks : Vec < Range < usize > > ,
249
249
expected : Vec < u64 > ,
250
250
) -> Result < ( ) > {
251
- let result = expr. create_evaluator ( ) ?. evaluate_with_rank_all ( 8 , & ranks) ?;
251
+ let result = expr. create_evaluator ( ) ?. evaluate_all_with_rank ( 8 , & ranks) ?;
252
252
let result = as_uint64_array ( & result) ?;
253
253
let result = result. values ( ) ;
254
254
assert_eq ! ( expected, * result) ;
Original file line number Diff line number Diff line change @@ -139,8 +139,7 @@ impl WindowExpr for SlidingAggregateWindowExpr {
139
139
}
140
140
141
141
fn uses_bounded_memory ( & self ) -> bool {
142
- self . aggregate . supports_bounded_execution ( )
143
- && !self . window_frame . end_bound . is_unbounded ( )
142
+ !self . window_frame . end_bound . is_unbounded ( )
144
143
}
145
144
}
146
145
You can’t perform that action at this time.
0 commit comments