pub fn create_ordering(
schema: &Schema,
sort_order: &[Vec<SortExpr>],
) -> Result<Vec<LexOrdering>>
Expand description
Converts logical sort expressions to physical sort expressions
This function transforms a collection of logical sort expressions into their physical representation that can be used during query execution.
§Arguments
schema
- The schema containing column definitionssort_order
- A collection of logical sort expressions grouped into lexicographic orderings
§Returns
A vector of lexicographic orderings for physical execution, or an error if the transformation fails
§Examples
// Create orderings from columns "id" and "name"
// Create a schema with two fields
let schema = Schema::new(vec![
Field::new("id", DataType::Int32, false),
Field::new("name", DataType::Utf8, false),
]);
let sort_exprs = vec![
vec![
SortExpr { expr: Expr::Column(Column::new(Some("t"), "id")), asc: true, nulls_first: false }
],
vec![
SortExpr { expr: Expr::Column(Column::new(Some("t"), "name")), asc: false, nulls_first: true }
]
];
let result = create_ordering(&schema, &sort_exprs).unwrap();