Beam Calcite SQL overview

Apache Calcite is a widespread SQL dialect used in big data processing with some streaming enhancements. Beam Calcite SQL is the default Beam SQL dialect.

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 Calcite SQL.

Query syntax

Query statements scan one or more tables or expressions and return the computed result rows. For more information about query statements in Beam Calcite SQL, see the Query syntax reference.

Lexical structure

A Beam SQL statement comprises a series of tokens. For more information about tokens in Beam Calcite SQL, 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 Calcite SQL, see the Data types reference.

Functions and operators

The following table summarizes the Apache Calcite functions and operators supported by Beam Calcite SQL.

Operators and functionsBeam SQL support status
Operator precedenceYes
Comparison operatorsSee Beam SQL scalar functions
Logical operatorsSee Beam SQL scalar functions
Arithmetic operators and functionsSee Beam SQL scalar functions
Character string operators and functionsSee Beam SQL scalar functions
Binary string operators and functionsNo
Date/time functionsSee Beam SQL scalar functions
System functionsNo
Conditional functions and operatorsSee Beam SQL scalar functions
Type conversionYes
Value constructorsNo, except array
Collection functionsNo
Period predicatesNo
JDBC function escapeNo
Aggregate functionsSee Beam SQL extension aggregate functions
Window functionsNo
Grouping functionsNo
Grouped window functionsSee Beam SQL extension windowing and triggering
Grouped auxiliary functionsYes, except SESSION_END
Spatial functionsNo
Geometry creation functions (3D)No
Geometry predicatesNo
JSON functionsNo
User-defined functionsSee Beam SQL extension user-defined functions. You cannot call functions with named and optional parameters.
MATCH_RECOGNIZENo
DDL ExtensionsSee Beam SQL extension CREATE EXTERNAL TABLE