Creates a vector of [LexOrdering] from a vector of logical expression
(
schema: &SchemaRef,
sort_order: &[Vec<SortExpr>],
execution_props: &ExecutionProps,
)
| 168 | |
| 169 | /// Creates a vector of [LexOrdering] from a vector of logical expression |
| 170 | pub 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 |
| 196 | pub fn create_physical_sort_expr( |
no test coverage detected
searching dependent graphs…