public class RexNodeExprFactory extends ExprFactory<org.apache.calcite.rex.RexNode>
RexNode
.Constructor and Description |
---|
RexNodeExprFactory(org.apache.calcite.rex.RexBuilder rexBuilder) |
Modifier and Type | Method and Description |
---|---|
protected void |
addExprToExprsList(org.apache.calcite.rex.RexNode columnList,
org.apache.calcite.rex.RexNode expr)
Adds expression to list of expressions (list needs to be
mutable).
|
protected TypeInfo |
adjustConstantType(PrimitiveTypeInfo targetType,
Object constantValue)
Adjust type of constant value based on input type, e.g., adjust precision and scale
of decimal value based on type information.
|
protected boolean |
convertCASEIntoCOALESCEFuncCallExpr(FunctionInfo fi,
List<org.apache.calcite.rex.RexNode> inputs)
Returns true if a CASE expression can be converted into a COALESCE function call.
|
static org.apache.calcite.rex.RexNode |
convertSubquerySomeAll(org.apache.calcite.plan.RelOptCluster cluster,
ASTNode comparisonOp,
SubqueryType subqueryType,
org.apache.calcite.rel.RelNode subqueryRel,
org.apache.calcite.rex.RexNode rexNodeLhs) |
protected org.apache.calcite.rex.RexNode |
createBigintConstantExpr(String value)
Creates a bigint constant expression from input value.
|
protected org.apache.calcite.rex.RexNode |
createBooleanConstantExpr(String value)
Creates a boolean constant expression from input value.
|
protected org.apache.calcite.rex.RexNode |
createColumnRefExpr(ColumnInfo colInfo,
List<RowResolver> rowResolverList)
Creates column expression.
|
protected org.apache.calcite.rex.RexNode |
createColumnRefExpr(ColumnInfo colInfo,
RowResolver rowResolver,
int offset)
Creates column expression.
|
protected org.apache.calcite.rex.RexNode |
createConstantExpr(TypeInfo typeInfo,
Object constantValue)
Creates a constant expression from input value with given type.
|
protected org.apache.calcite.rex.RexLiteral |
createDateConstantExpr(String value)
Creates a date constant expression from input value.
|
protected org.apache.calcite.rex.RexNode |
createDecimalConstantExpr(String value,
boolean allowNullValueConstantExpr)
Creates a decimal constant expression from input value.
|
protected org.apache.calcite.rex.RexNode |
createDoubleConstantExpr(String value)
Creates a double constant expression from input value.
|
protected org.apache.calcite.rex.RexNode |
createDynamicParamExpr(int index)
Creates a dynamic parameter expression with void type.
|
protected org.apache.calcite.rex.RexNode |
createExprsListExpr()
Creates list of expressions.
|
protected org.apache.calcite.rex.RexNode |
createFloatConstantExpr(String value)
Creates a float constant expression from input value.
|
protected org.apache.calcite.rex.RexNode |
createFuncCallExpr(TypeInfo typeInfo,
FunctionInfo functionInfo,
String funcText,
List<org.apache.calcite.rex.RexNode> inputs)
Creates function call expression.
|
protected org.apache.calcite.rex.RexNode |
createIntConstantExpr(String value)
Creates a int constant expression from input value.
|
protected org.apache.calcite.rex.RexLiteral |
createIntervalDayConstantExpr(String value)
Creates a interval day constant expression from input value.
|
protected org.apache.calcite.rex.RexLiteral |
createIntervalDayTimeConstantExpr(String value)
Creates a interval day-time constant expression from input value.
|
protected org.apache.calcite.rex.RexLiteral |
createIntervalHourConstantExpr(String value)
Creates a interval hour constant expression from input value.
|
protected org.apache.calcite.rex.RexLiteral |
createIntervalMinuteConstantExpr(String value)
Creates a interval minute constant expression from input value.
|
protected org.apache.calcite.rex.RexLiteral |
createIntervalMonthConstantExpr(String value)
Creates a interval month constant expression from input value.
|
protected org.apache.calcite.rex.RexLiteral |
createIntervalSecondConstantExpr(String value)
Creates a interval second constant expression from input value.
|
protected org.apache.calcite.rex.RexLiteral |
createIntervalYearConstantExpr(String value)
Creates a interval year constant expression from input value.
|
protected org.apache.calcite.rex.RexLiteral |
createIntervalYearMonthConstantExpr(String value)
Creates a interval year-month constant expression from input value.
|
protected org.apache.calcite.rex.RexNode |
createNestedColumnRefExpr(TypeInfo typeInfo,
org.apache.calcite.rex.RexNode expr,
String fieldName,
Boolean isList)
Creates a reference to a nested field.
|
protected org.apache.calcite.rex.RexNode |
createNullConstantExpr()
Creates a null constant expression with void type.
|
protected org.apache.calcite.rex.RexNode |
createSmallintConstantExpr(String value)
Creates a smallint constant expression from input value.
|
protected org.apache.calcite.rex.RexLiteral |
createStringConstantExpr(String value)
Creates a string constant expression from input value.
|
protected org.apache.calcite.rex.RexNode |
createStructExpr(TypeInfo typeInfo,
List<org.apache.calcite.rex.RexNode> operands)
Creates a struct with given type.
|
protected org.apache.calcite.rex.RexNode |
createSubqueryExpr(TypeCheckCtx ctx,
ASTNode expr,
SubqueryType subqueryType,
Object[] inputs)
Creates subquery expression.
|
protected org.apache.calcite.rex.RexLiteral |
createTimestampConstantExpr(String value)
Creates a timestamp constant expression from input value.
|
protected org.apache.calcite.rex.RexLiteral |
createTimestampLocalTimeZoneConstantExpr(String value,
ZoneId zoneId)
Creates a timestamp with local time zone constant expression from input value.
|
protected org.apache.calcite.rex.RexNode |
createTinyintConstantExpr(String value)
Creates a tinyint constant expression from input value.
|
protected org.apache.calcite.rex.RexNode |
foldExpr(org.apache.calcite.rex.RexNode expr)
Folds the input expression and returns resulting expression.
|
protected String |
getColumnName(org.apache.calcite.rex.RexNode expr,
RowResolver rowResolver)
Returns column name referenced by a column expression.
|
protected Object |
getConstantValue(org.apache.calcite.rex.RexNode expr)
Returns value stored in a constant expression.
|
protected String |
getConstantValueAsString(org.apache.calcite.rex.RexNode expr)
Returns value stored in a constant expression as String.
|
protected List<org.apache.calcite.rex.RexNode> |
getExprChildren(org.apache.calcite.rex.RexNode expr)
Returns the children from the input expression (if any).
|
protected FunctionInfo |
getFunctionInfo(String funcName)
Returns the FunctionInfo given the name
|
protected List<String> |
getStructNameList(org.apache.calcite.rex.RexNode expr)
Returns the list of names in the input struct expression.
|
protected List<TypeInfo> |
getStructTypeInfoList(org.apache.calcite.rex.RexNode expr)
Returns the list of types in the input struct expression.
|
protected TypeInfo |
getTypeInfo(org.apache.calcite.rex.RexNode expr)
Returns the type for the input expression.
|
protected Object |
interpretConstantAsPrimitive(PrimitiveTypeInfo targetType,
Object constantValue,
PrimitiveTypeInfo sourceType,
boolean isEqual)
Interpret the input constant value of source type as target type.
|
protected boolean |
isANDFuncCallExpr(org.apache.calcite.rex.RexNode expr)
Returns whether the input expression is an AND function call.
|
protected boolean |
isAndFunction(FunctionInfo fi) |
protected boolean |
isColumnRefExpr(Object o)
Returns whether the input object is a column reference expression.
|
protected boolean |
isCompareFunction(FunctionInfo fi) |
protected boolean |
isConsistentWithinQuery(FunctionInfo fi) |
protected boolean |
isConstantExpr(Object o)
Returns whether the input expression is a constant expression.
|
protected boolean |
isConstantStruct(org.apache.calcite.rex.RexNode expr)
Returns whether the input expression is a struct of
constant expressions (all of them).
|
protected boolean |
isEqualFunction(FunctionInfo fi) |
protected boolean |
isExprInstance(Object o)
Returns whether the input is an instance of the expression class.
|
protected boolean |
isExprsListExpr(Object o)
Returns whether the input expression is a list of expressions.
|
protected boolean |
isFuncCallExpr(Object o)
Returns whether the input expression is a function call.
|
protected boolean |
isInFunction(FunctionInfo fi) |
protected boolean |
isNEGATIVEFuncCallExpr(org.apache.calcite.rex.RexNode expr)
Returns whether the input expression is a NEGATIVE function call.
|
protected boolean |
isNSCompareFunction(FunctionInfo fi) |
protected boolean |
isORFuncCallExpr(org.apache.calcite.rex.RexNode expr)
Returns whether the input expression is an OR function call.
|
protected boolean |
isOrFunction(FunctionInfo fi) |
protected boolean |
isPOSITIVEFuncCallExpr(org.apache.calcite.rex.RexNode expr)
Returns whether the input expression is a POSITIVE function call.
|
protected boolean |
isStateful(FunctionInfo fi) |
protected boolean |
isSTRUCTFuncCallExpr(org.apache.calcite.rex.RexNode expr)
Returns whether the input expression is a STRUCT function call.
|
static org.apache.calcite.util.NlsString |
makeHiveUnicodeString(String text) |
protected org.apache.calcite.rex.RexNode |
replaceFieldNamesInStruct(org.apache.calcite.rex.RexNode expr,
List<String> newFieldNames) |
protected org.apache.calcite.rex.RexNode |
setTypeInfo(org.apache.calcite.rex.RexNode expr,
TypeInfo type)
Changes the type of the input expression to the input type and
returns resulting expression.
|
protected org.apache.calcite.rex.RexNode |
toExpr(ColumnInfo colInfo,
RowResolver rowResolver,
int offset)
Generates an expression from the input column.
|
convertCASEIntoIFFuncCallExpr, createConstantExpr, isAllConstants
public RexNodeExprFactory(org.apache.calcite.rex.RexBuilder rexBuilder)
protected boolean isExprInstance(Object o)
isExprInstance
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode toExpr(ColumnInfo colInfo, RowResolver rowResolver, int offset) throws CalciteSemanticException
toExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
CalciteSemanticException
protected org.apache.calcite.rex.RexNode createColumnRefExpr(ColumnInfo colInfo, RowResolver rowResolver, int offset) throws CalciteSemanticException
createColumnRefExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
CalciteSemanticException
protected org.apache.calcite.rex.RexNode createColumnRefExpr(ColumnInfo colInfo, List<RowResolver> rowResolverList) throws SemanticException
createColumnRefExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
SemanticException
protected org.apache.calcite.rex.RexNode createNullConstantExpr()
createNullConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode createDynamicParamExpr(int index)
createDynamicParamExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode createBooleanConstantExpr(String value)
createBooleanConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode createBigintConstantExpr(String value)
createBigintConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode createIntConstantExpr(String value)
createIntConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode createSmallintConstantExpr(String value)
createSmallintConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode createTinyintConstantExpr(String value)
createTinyintConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode createFloatConstantExpr(String value)
createFloatConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode createDoubleConstantExpr(String value) throws SemanticException
createDoubleConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
SemanticException
protected org.apache.calcite.rex.RexNode createDecimalConstantExpr(String value, boolean allowNullValueConstantExpr)
createDecimalConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected TypeInfo adjustConstantType(PrimitiveTypeInfo targetType, Object constantValue)
ExprFactory
adjustConstantType
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected Object interpretConstantAsPrimitive(PrimitiveTypeInfo targetType, Object constantValue, PrimitiveTypeInfo sourceType, boolean isEqual)
interpretConstantAsPrimitive
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createStringConstantExpr(String value)
createStringConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createDateConstantExpr(String value)
createDateConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createTimestampConstantExpr(String value)
createTimestampConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createTimestampLocalTimeZoneConstantExpr(String value, ZoneId zoneId)
createTimestampLocalTimeZoneConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createIntervalYearMonthConstantExpr(String value)
createIntervalYearMonthConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createIntervalDayTimeConstantExpr(String value)
createIntervalDayTimeConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createIntervalYearConstantExpr(String value)
createIntervalYearConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createIntervalMonthConstantExpr(String value)
createIntervalMonthConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createIntervalDayConstantExpr(String value)
createIntervalDayConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createIntervalHourConstantExpr(String value)
createIntervalHourConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createIntervalMinuteConstantExpr(String value)
createIntervalMinuteConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexLiteral createIntervalSecondConstantExpr(String value)
createIntervalSecondConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode createStructExpr(TypeInfo typeInfo, List<org.apache.calcite.rex.RexNode> operands) throws CalciteSemanticException
createStructExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
CalciteSemanticException
protected org.apache.calcite.rex.RexNode createConstantExpr(TypeInfo typeInfo, Object constantValue) throws CalciteSemanticException
createConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
CalciteSemanticException
protected org.apache.calcite.rex.RexNode createNestedColumnRefExpr(TypeInfo typeInfo, org.apache.calcite.rex.RexNode expr, String fieldName, Boolean isList) throws CalciteSemanticException
createNestedColumnRefExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
CalciteSemanticException
protected org.apache.calcite.rex.RexNode createFuncCallExpr(TypeInfo typeInfo, FunctionInfo functionInfo, String funcText, List<org.apache.calcite.rex.RexNode> inputs) throws SemanticException
createFuncCallExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
SemanticException
protected org.apache.calcite.rex.RexNode createExprsListExpr()
createExprsListExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected void addExprToExprsList(org.apache.calcite.rex.RexNode columnList, org.apache.calcite.rex.RexNode expr)
addExprToExprsList
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isConstantExpr(Object o)
isConstantExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isFuncCallExpr(Object o)
isFuncCallExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected Object getConstantValue(org.apache.calcite.rex.RexNode expr)
getConstantValue
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected String getConstantValueAsString(org.apache.calcite.rex.RexNode expr)
getConstantValueAsString
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isColumnRefExpr(Object o)
isColumnRefExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected String getColumnName(org.apache.calcite.rex.RexNode expr, RowResolver rowResolver)
getColumnName
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isExprsListExpr(Object o)
isExprsListExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected List<org.apache.calcite.rex.RexNode> getExprChildren(org.apache.calcite.rex.RexNode expr)
getExprChildren
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected TypeInfo getTypeInfo(org.apache.calcite.rex.RexNode expr)
getTypeInfo
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected List<TypeInfo> getStructTypeInfoList(org.apache.calcite.rex.RexNode expr)
getStructTypeInfoList
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected List<String> getStructNameList(org.apache.calcite.rex.RexNode expr)
getStructNameList
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isORFuncCallExpr(org.apache.calcite.rex.RexNode expr)
isORFuncCallExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isANDFuncCallExpr(org.apache.calcite.rex.RexNode expr)
isANDFuncCallExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isConsistentWithinQuery(FunctionInfo fi)
isConsistentWithinQuery
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isStateful(FunctionInfo fi)
isStateful
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isPOSITIVEFuncCallExpr(org.apache.calcite.rex.RexNode expr)
isPOSITIVEFuncCallExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isNEGATIVEFuncCallExpr(org.apache.calcite.rex.RexNode expr)
isNEGATIVEFuncCallExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode setTypeInfo(org.apache.calcite.rex.RexNode expr, TypeInfo type) throws CalciteSemanticException
setTypeInfo
in class ExprFactory<org.apache.calcite.rex.RexNode>
CalciteSemanticException
protected boolean convertCASEIntoCOALESCEFuncCallExpr(FunctionInfo fi, List<org.apache.calcite.rex.RexNode> inputs)
convertCASEIntoCOALESCEFuncCallExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode foldExpr(org.apache.calcite.rex.RexNode expr)
foldExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isSTRUCTFuncCallExpr(org.apache.calcite.rex.RexNode expr)
isSTRUCTFuncCallExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isAndFunction(FunctionInfo fi)
isAndFunction
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isOrFunction(FunctionInfo fi)
isOrFunction
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isInFunction(FunctionInfo fi)
isInFunction
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isCompareFunction(FunctionInfo fi)
isCompareFunction
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isEqualFunction(FunctionInfo fi)
isEqualFunction
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isNSCompareFunction(FunctionInfo fi)
isNSCompareFunction
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected boolean isConstantStruct(org.apache.calcite.rex.RexNode expr)
isConstantStruct
in class ExprFactory<org.apache.calcite.rex.RexNode>
protected org.apache.calcite.rex.RexNode createSubqueryExpr(TypeCheckCtx ctx, ASTNode expr, SubqueryType subqueryType, Object[] inputs) throws SemanticException
createSubqueryExpr
in class ExprFactory<org.apache.calcite.rex.RexNode>
SemanticException
protected FunctionInfo getFunctionInfo(String funcName) throws SemanticException
getFunctionInfo
in class ExprFactory<org.apache.calcite.rex.RexNode>
SemanticException
protected org.apache.calcite.rex.RexNode replaceFieldNamesInStruct(org.apache.calcite.rex.RexNode expr, List<String> newFieldNames)
replaceFieldNamesInStruct
in class ExprFactory<org.apache.calcite.rex.RexNode>
public static org.apache.calcite.rex.RexNode convertSubquerySomeAll(org.apache.calcite.plan.RelOptCluster cluster, ASTNode comparisonOp, SubqueryType subqueryType, org.apache.calcite.rel.RelNode subqueryRel, org.apache.calcite.rex.RexNode rexNodeLhs) throws SemanticException
SemanticException
public static org.apache.calcite.util.NlsString makeHiveUnicodeString(String text)
Copyright © 2022 The Apache Software Foundation. All rights reserved.