Expand description
The GoogleSQL (BigQuery) syntax tree.
Every node derives Clone, PartialEq, Eq, Hash and serde. Equality is structural and
ignores pure spelling: an identifier’s quoting and a string literal’s quote style do not take
part, so `a` equals a and 'x' equals "x".
Structs§
- Align
ALIGN (...): time-series alignment of an input to a regular grid of periods. The output is thePARTITION BYcolumns, then theMETRICS, then the aligned timestamp column.- Align
Metric - One
METRICSitem ofALIGN. - Alter
Table - Assignment
target = valueinUPDATE ... SETandMERGE ... UPDATE SET; the target is a path (a.b).- Bytes
Literal - Case
When - Column
Def - Conditional
Block cond THEN statementsof anIF/ELSEIFor aCASEstatement’sWHEN.- Create
Function - Create
Procedure - Create
Schema - Create
Table - Create
Table Function - Create
View - Cte
- Delete
- Drop
- Export
Data - Expr
With Alias - An expression with an optional
AS name. - Function
- Function
Param - Having
Bound HAVING MAX expr/HAVING MIN exprin an aggregate.- Ident
- One identifier.
quotedrecords whether it was written in backticks. - Insert
- Interval
Literal INTERVAL value part [TO part].- Join
- Limit
- Load
Data LOAD DATA {INTO|OVERWRITE} [TEMP TABLE] name ...; the clauses after the name are kept as text.- Match
Recognize MATCH_RECOGNIZE (...): row pattern recognition over an ordered input. BigQuery returns one row per match: thePARTITION BYcolumns, then theMEASURES.- Merge
- Merge
Clause - Named
Window - Object
Name - A dotted name: a table, routine or column path (
`p.d.t`,p.d.t,SAFE.DIVIDE). - Order
ByExpr - Pipe
Expr Item - An expression item of
|> AGGREGATEor itsGROUP BY, with optional alias and order. - Procedure
Param - Query
- A query: an optional
WITH, a body,ORDER BY/LIMIT, then any pipe operators. - Select
- SqlOption
name = valueinsideOPTIONS(...).- String
Literal - A string or bytes literal. Equality compares the value only, not the quotes used.
- Struct
Expr Field - A field of
STRUCT(expr AS name)or(a, b). - Struct
Field - A field of
STRUCT<name type>or a column ofTABLE<...>. - Table
Copy - Table
Name - A table identity:
project.dataset.name, with the leading parts optional. - Table
Sample - Table
With Joins - Unpivot
Columns - Update
- View
Column - Wildcard
Options - Window
Frame - Window
Spec - With
Enums§
- After
Match Skip AFTER MATCH SKIP ...- Alter
Action - Alter
Column Action - Binary
Operator - Control
Kind - Copy
Kind LIKE,COPYorCLONEa table inCREATE TABLE.- Corresponding
- How a set operation lines up columns.
- Data
Type - A GoogleSQL data type. Aliases (
INT,INTEGER,DECIMAL, …) map to the canonical type. - Expr
- A GoogleSQL expression.
- Frame
Bound - Frame
Units - Function
Arg - Function
Body - GroupBy
- Group
ByItem - Insert
Source - Join
Constraint - Join
Kind - Like
Patterns - Like
Quantifier - Literal
- Merge
Action - Merge
Match - Null
Treatment - Object
Type - Param
Mode - Param
Type - A routine parameter type: a data type,
ANY TYPE,TABLE<...>orANY TABLE. - Parameter
- Pattern
Quantifier - A row pattern quantifier.
- Pipe
Operator - RowPattern
- A
PATTERNofMATCH_RECOGNIZE. - Sample
Unit - Select
As - Select
Item - SetExpr
- SetOp
Mode FULL/LEFT/INNERbefore a set operator (column matching mode).- SetOperator
- SetQuantifier
- Statement
- One GoogleSQL statement.
- Subscript
Kind - Table
Constraint - Table
Factor - Table
Kind - Transaction
Kind - Unary
Operator - Window
Type
Constants§
- COMPARISON_
PRECEDENCE - Precedence of comparison-level predicates (
IS,IN,LIKE,BETWEEN). - NOT_
PRECEDENCE - Precedence of prefix
NOT. - UNARY_
PRECEDENCE - Precedence of unary
-,+,~.
Traits§
- Visitor
- Something a query walk can visit: queries, selects, expressions and table factors.
Functions§
- walk_
expr - Walk an expression and everything inside it (subqueries included).
- walk_
expr_ mut - Call
fon every expression insideexpr, children first (so a replacement is not walked again). Withinto_queries, expressions of subqueries are visited too. - walk_
query - Walk a query and everything inside it.
- walk_
query_ exprs_ mut - Call
fon every expression of the query, subqueries and CTEs included, children first. - walk_
select - Walk a select and everything inside it.
- walk_
statement - Walk every node of a statement, calling the visitor before descending.
- walk_
statement_ exprs_ mut - Call
fon every expression a statement holds (subqueries included), children first. - walk_
table_ factor - Walk a table factor.
- walk_
table_ with_ joins - Walk a FROM item with its joins.