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

Function create_lex_ordering

datafusion/physical-expr/src/physical_expr.rs:170–193  ·  view source on GitHub ↗

Creates a vector of [LexOrdering] from a vector of logical expression

(
    schema: &SchemaRef,
    sort_order: &[Vec<SortExpr>],
    execution_props: &ExecutionProps,
)

Source from the content-addressed store, hash-verified

168
169/// Creates a vector of [LexOrdering] from a vector of logical expression
170pub fn create_lex_ordering(
171 schema: &SchemaRef,
172 sort_order: &[Vec<SortExpr>],
173 execution_props: &ExecutionProps,
174) -> Result<Vec<LexOrdering>> {
175 // Try the fast path that only supports column references first
176 // This avoids creating a DFSchema
177 if let Ok(ordering) = create_ordering(schema, sort_order) {
178 return Ok(ordering);
179 }
180
181 let df_schema = DFSchema::try_from(Arc::clone(schema))?;
182
183 let mut all_sort_orders = vec![];
184
185 for exprs in sort_order.iter() {
186 all_sort_orders.extend(LexOrdering::new(create_physical_sort_exprs(
187 exprs,
188 &df_schema,
189 execution_props,
190 )?));
191 }
192 Ok(all_sort_orders)
193}
194
195/// Create a physical sort expression from a logical expression
196pub fn create_physical_sort_expr(

Callers 3

scanMethod · 0.85
insert_intoMethod · 0.85

Calls 5

create_orderingFunction · 0.85
newFunction · 0.85
iterMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…