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],
)
| 46 | |
| 47 | /// Construct corresponding fields for the expressions in an ORDER BY clause. |
| 48 | pub 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. |
| 69 | pub fn get_sort_options(ordering_req: &LexOrdering) -> Vec<SortOptions> { |