Function mz_sqllogictest::runner::derive_order_by
source · fn derive_order_by(
body: &SetExpr<Raw>,
order_by: &Vec<OrderByExpr<Raw>>,
) -> (Vec<OrderByExpr<Raw>>, Vec<SelectItem<Raw>>, Option<Distinct<Raw>>)
Expand description
Analyzes a query’s ORDER BY
clause to derive an ORDER BY
clause that makes numeric references to any expressions in
the projection and generated-attribute references to expressions
that need to be added as extra columns to the projection list.
The rewritten ORDER BY
clause is then usable when querying a
view that contains the same SELECT
as the given query.
This function returns both the rewritten ORDER BY
clause
as well as a list of extra columns that need to be added
to the query’s projection for the ORDER BY
clause to
succeed.