alamb commented on code in PR #4675: URL: https://github.com/apache/arrow-datafusion/pull/4675#discussion_r1053799467
########## datafusion/physical-expr/src/aggregate/min_max.rs: ########## @@ -541,22 +543,38 @@ pub fn max_row(index: usize, accessor: &mut RowAccessor, s: &ScalarValue) -> Res #[derive(Debug)] pub struct MaxAccumulator { max: ScalarValue, + moving_max: moving_min_max::MovingMax<ScalarValue>, } impl MaxAccumulator { /// new max accumulator pub fn try_new(datatype: &DataType) -> Result<Self> { Ok(Self { max: ScalarValue::try_from(datatype)?, + moving_max: moving_min_max::MovingMax::<ScalarValue>::new(), }) } } impl Accumulator for MaxAccumulator { fn update_batch(&mut self, values: &[ArrayRef]) -> Result<()> { - let values = &values[0]; - let delta = &max_batch(values)?; - self.max = max(&self.max, delta)?; + for idx in 0..values[0].len() { Review Comment: @mustafasrepo are you saying that you believe this PR will not negatively impact the performance of a query such as the following? ```sql select MIN(time) from my_table_with_10000000_rows; ``` -- 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...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org