MCPcopy Create free account
hub / github.com/PRQL/prql / translate_column_sort

Function translate_column_sort

prqlc/prqlc/src/sql/gen_expr.rs:911–927  ·  view source on GitHub ↗
(
    sort: &ColumnSort<rq::CId>,
    ctx: &mut Context,
)

Source from the content-addressed store, hash-verified

909}
910
911pub(super) fn translate_column_sort(
912 sort: &ColumnSort<rq::CId>,
913 ctx: &mut Context,
914) -> Result<OrderByExpr> {
915 Ok(OrderByExpr {
916 expr: translate_cid(sort.column, ctx)?.into_ast(),
917 options: sqlparser::ast::OrderByOptions {
918 asc: if matches!(sort.direction, SortDirection::Asc) {
919 None // default order is ASC, so there is no need to emit it
920 } else {
921 Some(false)
922 },
923 nulls_first: None,
924 },
925 with_fill: None,
926 })
927}
928
929/// Translate a PRQL Ident to a Vec of SQL Idents.
930// We return a vec of SQL Idents because sqlparser sometimes uses

Callers 2

translate_windowedFunction · 0.85

Calls 2

translate_cidFunction · 0.85
into_astMethod · 0.80

Tested by

no test coverage detected