Beam ZetaSQL overview

Beam SQL supports a varient of the ZetaSQL language. ZetaSQL is similar to the language in BigQuery’s SQL framework. This Beam SQL dialect is especially useful in pipelines that write to or read from BigQuery tables.

Beam SQL has additional extensions leveraging Beam’s unified batch/streaming model and processing complex data types. You can use these extensions with all Beam SQL dialects, including Beam ZetaSQL.

Query syntax

Query statements scan tables or expressions and return the computed result rows. For more information about query statements in Beam ZetaSQL, see the Query syntax reference and Function call rules.

Lexical structure

A Beam SQL statement comprises a series of tokens. For more information about tokens in Beam ZetaSQL, see the Lexical structure reference.

Data types

Beam SQL supports standard SQL scalar data types as well as extensions including arrays, maps, and nested rows. For more information about scalar data in Beam ZetaSQL, see the Data types reference.

Functions and operators

The following table summarizes the ZetaSQL functions and operators supported by Beam ZetaSQL.

Operators and functionsBeam ZetaSQL support
Type conversionYes
Aggregate functionsSee Beam SQL aggregate functions
Statistical aggregate functionsNo
Approximate aggregate functionsNo
HyperLogLog++ functionsNo
KLL16 quantile functionsNo
Numbering functionsNo
Bit functionsNo
Mathematical functionsSee mathematical functions
Navigation functionsNo
Aggregate analytic functionsSee aggregate functions
Hash functionsNo
String functionsSee string functions
JSON functionsNo
Array functionsNo
Date functionsNo
DateTime functionsNo
Time functionsNo
Timestamp functionsNo
Protocol buffer functionsNo
Security functionsNo
Net functionsNo
Operator precedenceYes
Conditional expressionsSee conditional expressions
Expression subqueriesNo
Debugging functionsNo