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

Function ordering_fields

datafusion/functions-aggregate-common/src/utils.rs:48–66  ·  view source on GitHub ↗

Construct corresponding fields for the expressions in an ORDER BY clause.

(
    order_bys: &[PhysicalSortExpr],
    // Data type of each expression in the ordering requirement
    data_types: &[DataType],
)

Source from the content-addressed store, hash-verified

46
47/// Construct corresponding fields for the expressions in an ORDER BY clause.
48pub fn ordering_fields(
49 order_bys: &[PhysicalSortExpr],
50 // Data type of each expression in the ordering requirement
51 data_types: &[DataType],
52) -> Vec<FieldRef> {
53 order_bys
54 .iter()
55 .zip(data_types.iter())
56 .map(|(sort_expr, dtype)| {
57 Field::new(
58 sort_expr.expr.to_string().as_str(),
59 dtype.clone(),
60 // Multi partitions may be empty hence field should be nullable.
61 true,
62 )
63 })
64 .map(Arc::new)
65 .collect()
66}
67
68/// Selects the sort option attribute from all the given `PhysicalSortExpr`s.
69pub fn get_sort_options(ordering_req: &LexOrdering) -> Vec<SortOptions> {

Callers 3

buildMethod · 0.85
evaluate_orderingsMethod · 0.85
evaluate_orderingsMethod · 0.85

Calls 7

newFunction · 0.85
collectMethod · 0.80
mapMethod · 0.45
iterMethod · 0.45
as_strMethod · 0.45
to_stringMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…