ashdnazg commented on code in PR #15924: URL: https://github.com/apache/datafusion/pull/15924#discussion_r2077189430
########## datafusion/functions-aggregate/src/min_max.rs: ########## @@ -645,19 +645,29 @@ fn min_max_batch_struct(array: &ArrayRef, ordering: Ordering) -> Result<ScalarVa } } } - // use force_clone to free array reference - Ok(extreme.force_clone()) + + Ok(extreme) } macro_rules! min_max_struct { ($VALUE:expr, $DELTA:expr, $OP:ident) => {{ if $VALUE.is_null() { - $DELTA.clone() + let mut delta_copy = $DELTA.clone(); + // When the new value won we want to compact it to + // avoid storing the entire input + delta_copy.compact(); Review Comment: I moved compaction here so it's only done if we're definitely going to keep a reference to the new value. -- 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