Package org.apache.calcite.test.catalog
Class CountingFactory
java.lang.Object
org.apache.calcite.sql2rel.NullInitializerExpressionFactory
org.apache.calcite.test.catalog.CountingFactory
- All Implemented Interfaces:
InitializerExpressionFactory
To check whether
InitializerExpressionFactory.newColumnDefaultValue(org.apache.calcite.plan.RelOptTable, int, org.apache.calcite.sql2rel.InitializerContext) is called.
If a column is in defaultColumns, returns 1 as the default
value.
-
Field Summary
FieldsFields inherited from class org.apache.calcite.sql2rel.NullInitializerExpressionFactory
INSTANCE -
Method Summary
Modifier and TypeMethodDescriptiongenerationStrategy(RelOptTable table, int iColumn) Returns how a column is populated.newAttributeInitializer(RelDataType type, SqlFunction constructor, int iAttribute, List<RexNode> constructorArgs, InitializerContext context) Creates an expression which evaluates to the initializer expression for a particular attribute of a structured type.newColumnDefaultValue(RelOptTable table, int iColumn, InitializerContext context) Creates an expression which evaluates to the default value for a particular column.Methods inherited from class org.apache.calcite.sql2rel.NullInitializerExpressionFactory
isGeneratedAlways, postExpressionConversionHook
-
Field Details
-
THREAD_CALL_COUNT
-
-
Method Details
-
generationStrategy
Description copied from interface:InitializerExpressionFactoryReturns how a column is populated.- Specified by:
generationStrategyin interfaceInitializerExpressionFactory- Overrides:
generationStrategyin classNullInitializerExpressionFactory- Parameters:
table- the table containing the columniColumn- the 0-based offset of the column in the table- Returns:
- generation strategy, never null
- See Also:
-
newColumnDefaultValue
Description copied from interface:InitializerExpressionFactoryCreates an expression which evaluates to the default value for a particular column.If the default value comes from a un-validated
SqlNode, make sure to invokeInitializerContext.validateExpression(org.apache.calcite.rel.type.RelDataType, org.apache.calcite.sql.SqlNode)first before you actually do the conversion with methodInitializerContext.convertExpression(org.apache.calcite.sql.SqlNode).- Specified by:
newColumnDefaultValuein interfaceInitializerExpressionFactory- Overrides:
newColumnDefaultValuein classNullInitializerExpressionFactory- Parameters:
table- the table containing the columniColumn- the 0-based offset of the column in the tablecontext- Context for creating the expression- Returns:
- default value expression
-
newAttributeInitializer
public RexNode newAttributeInitializer(RelDataType type, SqlFunction constructor, int iAttribute, List<RexNode> constructorArgs, InitializerContext context) Description copied from interface:InitializerExpressionFactoryCreates an expression which evaluates to the initializer expression for a particular attribute of a structured type.- Specified by:
newAttributeInitializerin interfaceInitializerExpressionFactory- Overrides:
newAttributeInitializerin classNullInitializerExpressionFactory- Parameters:
type- the structured typeconstructor- the constructor invoked to initialize the typeiAttribute- the 0-based offset of the attribute in the typeconstructorArgs- arguments passed to the constructor invocationcontext- Context for creating the expression- Returns:
- default value expression
-