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 |
---|---|
BeamSqlTable |
findTable(java.lang.String tableName)
Find
BaseBeamTable by table name. |
BeamQueryPlanner |
getPlanner() |
void |
registerTable(java.lang.String tableName,
BeamSqlTable table)
Registers a
BaseBeamTable which can be used for all subsequent queries. |
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<? 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<? 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 registerTable(java.lang.String tableName, BeamSqlTable table)
BaseBeamTable
which can be used for all subsequent queries.public BeamSqlTable findTable(java.lang.String tableName)
BaseBeamTable
by table name.public BeamQueryPlanner getPlanner()