MCPcopy Create free account
hub / github.com/apache/datafusion / evaluate_orderings

Method evaluate_orderings

datafusion/functions-aggregate/src/array_agg.rs:1000–1023  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

998 }
999
1000 fn evaluate_orderings(&self) -> Result<ScalarValue> {
1001 let fields = ordering_fields(&self.ordering_req, &self.datatypes[1..]);
1002
1003 let column_wise_ordering_values = if self.ordering_values.is_empty() {
1004 fields
1005 .iter()
1006 .map(|f| new_empty_array(f.data_type()))
1007 .collect::<Vec<_>>()
1008 } else {
1009 (0..fields.len())
1010 .map(|i| {
1011 let column_values = self.ordering_values.iter().map(|x| x[i].clone());
1012 ScalarValue::iter_to_array(column_values)
1013 })
1014 .collect::<Result<_>>()?
1015 };
1016
1017 let ordering_array = StructArray::try_new(
1018 Fields::from(fields),
1019 column_wise_ordering_values,
1020 None,
1021 )?;
1022 Ok(SingleRowListArrayBuilder::new(Arc::new(ordering_array)).build_list_scalar())
1023 }
1024}
1025
1026impl Accumulator for OrderSensitiveArrayAggAccumulator {

Callers 1

stateMethod · 0.45

Calls 9

ordering_fieldsFunction · 0.85
newFunction · 0.85
build_list_scalarMethod · 0.80
is_emptyMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
data_typeMethod · 0.45
lenMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected