public interface InitializerContext
InitializerExpressionFactory methods.| Modifier and Type | Method and Description |
|---|---|
RexNode |
convertExpression(SqlNode expr)
Converts a
SqlNode to RexNode. |
RexBuilder |
getRexBuilder() |
default SqlNode |
parseExpression(SqlParser.Config config,
String expr)
Parse a column computation expression for a table.
|
SqlNode |
validateExpression(RelDataType rowType,
SqlNode expr)
Validate the expression with a base table row type.
|
RexBuilder getRexBuilder()
default SqlNode parseExpression(SqlParser.Config config, String expr)
create table t(
a int not null,
b varchar(5) as (my_udf(a)) virtual,
c int not null as (a + 1)
);
You can use the string format expression "my_udf(a)" and "a + 1" as the initializer expression of column b and c.
Calcite doesn't really need this now because the DDL nodes
can be executed directly from SqlNodes, but we still provide the way
to initialize from a SQL-like string, because a string can be used to persist easily and
the column expressions are important part of the table metadata.
config - parse configexpr - the SQL-style column expressionSqlNode instanceSqlNode validateExpression(RelDataType rowType, SqlNode expr)
rowType - the table row typeexpr - the expressionSqlNode, usually it transforms
from a SqlUnresolvedFunction to a resolved oneRexNode convertExpression(SqlNode expr)
SqlNode to RexNode.
Caution that the SqlNode must be validated,
you can use validateExpression(org.apache.calcite.rel.type.RelDataType, org.apache.calcite.sql.SqlNode) to validate if the SqlNode
is un-validated.
expr - the expression of sql node to convertRexNode instanceCopyright © 2012-2022 Apache Software Foundation. All Rights Reserved.