public class BeamSqlEnv
extends java.lang.Object
implements java.io.Serializable
BeamSqlEnv
prepares the execution context for BeamSql
and BeamSqlCli
.
It contains a SchemaPlus
which holds the metadata of tables/UDF functions, and a
BeamQueryPlanner
which parse/validate/optimize/translate input SQL queries.
Constructor and Description |
---|
BeamSqlEnv() |
Modifier and Type | Method and Description |
---|---|
void |
deregisterTable(java.lang.String targetTableName) |
BeamSqlTable |
findTable(java.lang.String tableName)
Find
BaseBeamTable by table name. |
BeamQueryPlanner |
getPlanner() |
void |
registerPCollection(java.lang.String name,
PCollection<Row> pCollection)
Registers
PCollection of Row s as a table. |
void |
registerPCollectionTuple(PCollectionTuple pCollectionTuple)
Registers
PCollection s in PCollectionTuple as a tables. |
void |
registerTable(java.lang.String tableName,
BeamSqlTable table)
Registers a
BaseBeamTable which can be used for all subsequent queries. |
void |
registerTable(java.lang.String tableName,
PCollection<Row> pCollection,
RowType rowType)
Registers
PCollection as a table. |
void |
registerUdaf(java.lang.String functionName,
Combine.CombineFn combineFn)
Register a UDAF function which can be used in GROUP-BY expression.
|
void |
registerUdf(java.lang.String functionName,
java.lang.Class<?> clazz,
java.lang.String method)
Register a UDF function which can be used in SQL expression.
|
void |
registerUdf(java.lang.String functionName,
java.lang.Class<? extends BeamSqlUdf> clazz)
Register a UDF function which can be used in SQL expression.
|
void |
registerUdf(java.lang.String functionName,
SerializableFunction sfn)
Register
SerializableFunction as a UDF function which can be used in SQL expression. |
public void registerUdf(java.lang.String functionName, java.lang.Class<?> clazz, java.lang.String method)
public void registerUdf(java.lang.String functionName, java.lang.Class<? extends BeamSqlUdf> clazz)
public void registerUdf(java.lang.String functionName, SerializableFunction sfn)
SerializableFunction
as a UDF function which can be used in SQL expression.
Note, SerializableFunction
must have a constructor without arguments.public void registerUdaf(java.lang.String functionName, Combine.CombineFn combineFn)
Combine.CombineFn
on how to implement a UDAF.public void registerPCollectionTuple(PCollectionTuple pCollectionTuple)
PCollection
s in PCollectionTuple
as a tables.
Assumes that PCollection
elements are Row
s.
TupleTag.getId()
s are used as table names.
public void registerPCollection(java.lang.String name, PCollection<Row> pCollection)
PCollection
of Row
s as a table.
Assumes that PCollection.getCoder()
returns an instance of RowCoder
.
public void registerTable(java.lang.String tableName, PCollection<Row> pCollection, RowType rowType)
PCollection
as a table.public void registerTable(java.lang.String tableName, BeamSqlTable table)
BaseBeamTable
which can be used for all subsequent queries.public void deregisterTable(java.lang.String targetTableName)
public BeamSqlTable findTable(java.lang.String tableName)
BaseBeamTable
by table name.public BeamQueryPlanner getPlanner()