kosiew commented on code in PR #21315:
URL: https://github.com/apache/datafusion/pull/21315#discussion_r3115956344
##########
datafusion/functions-aggregate-common/src/min_max.rs:
##########
@@ -423,6 +439,53 @@ macro_rules! min_max {
}};
}
+fn scalar_batch_extreme(values: &ArrayRef, ordering: Ordering) ->
Result<ScalarValue> {
+ let mut index = 0;
+ let mut extreme = loop {
+ if index == values.len() {
+ return ScalarValue::try_from(values.data_type());
+ }
+
+ let current = ScalarValue::try_from_array(values, index)?;
+ index += 1;
+
+ if !current.is_null() {
+ break current;
+ }
+ };
+
+ while index < values.len() {
+ let current = ScalarValue::try_from_array(values, index)?;
+ index += 1;
+
+ if !current.is_null() && extreme.try_cmp(¤t)? == ordering {
+ extreme = current;
+ }
+ }
+
+ Ok(extreme)
+}
+
+fn dictionary_scalar_parts(value: &ScalarValue) -> (&ScalarValue,
Option<&DataType>) {
+ match value {
+ ScalarValue::Dictionary(key_type, inner) => {
+ (inner.as_ref(), Some(key_type.as_ref()))
+ }
+ other => (other, None),
+ }
+}
+
+fn is_row_wise_batch_type(data_type: &DataType) -> bool {
Review Comment:
That’s a reasonable direction. After looking back at the diff, I agree the
current helper extraction does not buy much, especially since it introduced
indirection right where the dictionary behavior is most important to read
clearly.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]