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