MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / doc_select_statement

Method doc_select_statement

src/sql-pretty/src/doc.rs:911–929  ·  view source on GitHub ↗
(
        &'a self,
        v: &'a SelectStatement<T>,
    )

Source from the content-addressed store, hash-verified

909 }
910
911 pub(crate) fn doc_select_statement<'a, T: AstInfo>(
912 &'a self,
913 v: &'a SelectStatement<T>,
914 ) -> RcDoc<'a> {
915 let query = self.doc_query(&v.query);
916 // A query whose rendering begins with `SHOW` (a bare `SHOW` body or a
917 // set operation whose leftmost operand is one) only reparses when
918 // parenthesized — a top-level leading `SHOW` is dispatched directly and
919 // terminates the statement. Mirror `AstDisplay for SelectStatement`.
920 let mut doc = if v.query.body.starts_with_show() {
921 bracket("(", query, ")")
922 } else {
923 query
924 };
925 if let Some(as_of) = &v.as_of {
926 doc = intersperse_line_nest([doc, self.doc_as_of(as_of)]);
927 }
928 doc.group()
929 }
930
931 fn doc_order_by<'a, T: AstInfo>(&'a self, v: &'a [OrderByExpr<T>]) -> RcDoc<'a> {
932 title_comma_separate("ORDER BY", |o| self.doc_order_by_expr(o), v)

Callers 2

to_docMethod · 0.80
doc_copyMethod · 0.80

Calls 6

bracketFunction · 0.85
intersperse_line_nestFunction · 0.85
doc_queryMethod · 0.80
starts_with_showMethod · 0.80
doc_as_ofMethod · 0.80
groupMethod · 0.80

Tested by

no test coverage detected