Class RexImpTable
- java.lang.Object
-
- org.apache.calcite.adapter.enumerable.RexImpTable
-
public class RexImpTable extends java.lang.Object
Contains implementations of Rex operators as Java code.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RexImpTable.BinaryImplementor
Implementor for binary operators.private static class
RexImpTable.CaseImplementor
Implementor for the SQLCASE
operator.private static class
RexImpTable.CastImplementor
Implementor for the SQLCAST
operator.private static class
RexImpTable.CastOptimizedImplementor
Implementor for the SQLCAST
function that optimizes if, say, the argument is already of the desired type.private static class
RexImpTable.CoalesceImplementor
Implementor for the SQLCOALESCE
operator.(package private) static class
RexImpTable.CollectImplementor
Implementor for theCOLLECT
aggregate function.(package private) static class
RexImpTable.CountImplementor
Implementor for theCOUNT
aggregate function.(package private) static class
RexImpTable.CountWinImplementor
Implementor for theCOUNT
windowed aggregate function.private static class
RexImpTable.DatetimeArithmeticImplementor
Implementor for various datetime arithmetic.(package private) static class
RexImpTable.DenseRankImplementor
Implementor for theDENSE_RANK
windowed aggregate function.private static class
RexImpTable.ExtractImplementor
Implementor for theEXTRACT(unit FROM datetime)
function.(package private) static class
RexImpTable.FirstLastValueImplementor
Implementor for theFIRST_VALUE
andLAST_VALUE
windowed aggregate functions.(package private) static class
RexImpTable.FirstValueImplementor
Implementor for theFIRST_VALUE
windowed aggregate function.private static class
RexImpTable.FloorImplementor
Implementor for theFLOOR
andCEIL
functions.(package private) static class
RexImpTable.FusionImplementor
Implementor for theFUSION
aggregate function.(package private) static class
RexImpTable.GroupingImplementor
Implementor for theGROUPING
aggregate function.private static class
RexImpTable.IsXxxImplementor
Implements "IS XXX" operations such as "IS NULL" or "IS NOT TRUE".private static class
RexImpTable.ItemImplementor
Implementor for theITEM
SQL operator.(package private) static class
RexImpTable.JsonArrayAggImplementor
Implementor for theJSON_ARRAYAGG
aggregate function.(package private) static class
RexImpTable.JsonObjectAggImplementor
Implementor for theJSON_OBJECTAGG
aggregate function.static class
RexImpTable.LagImplementor
Implementor for theLAG
windowed aggregate function.(package private) static class
RexImpTable.LastValueImplementor
Implementor for theLAST_VALUE
windowed aggregate function.static class
RexImpTable.LeadImplementor
Implementor for theLEAD
windowed aggregate function.(package private) static class
RexImpTable.LeadLagImplementor
Implementor for theLEAD
andLAG
windowed aggregate functions.private static class
RexImpTable.MethodImplementor
Implementor for a function that generates calls to a given method.private static class
RexImpTable.MethodNameImplementor
Implementor for SQL functions that generates calls to a given method name.(package private) static class
RexImpTable.MinMaxImplementor
Implementor for theMIN
andMAX
aggregate functions.private static class
RexImpTable.NotImplementor
Implementor for theNOT
operator.(package private) static class
RexImpTable.NthValueImplementor
Implementor for theNTH_VALUE
windowed aggregate function.(package private) static class
RexImpTable.NtileImplementor
Implementor for theNTILE
windowed aggregate function.static class
RexImpTable.NullAs
Strategy what an operator should return if one of its arguments is null.(package private) static class
RexImpTable.RankImplementor
Implementor for theRANK
windowed aggregate function.private static class
RexImpTable.ReinterpretImplementor
Implementor for theREINTERPRET
internal SQL operator.(package private) static class
RexImpTable.RowNumberImplementor
Implementor for theROW_NUMBER
windowed aggregate function.(package private) static class
RexImpTable.SingleValueImplementor
Implementor for theSINGLE_VALUE
aggregate function.(package private) static class
RexImpTable.SumImplementor
Implementor for theSUM
windowed aggregate function.private static class
RexImpTable.SystemFunctionImplementor
Implementor for SQL system functions.private static class
RexImpTable.TrimImplementor
Implementor for theTRIM
function.private static class
RexImpTable.UnaryImplementor
Implementor for unary operators.static class
RexImpTable.UserDefinedAggReflectiveImplementor
Implementor for user-defined aggregate functions.private static class
RexImpTable.ValueConstructorImplementor
Implementor for a value-constructor.
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<SqlAggFunction,java.util.function.Supplier<? extends AggImplementor>>
aggMap
static MemberExpression
BOXED_FALSE_EXPR
static MemberExpression
BOXED_TRUE_EXPR
static ConstantExpression
FALSE_EXPR
static RexImpTable
INSTANCE
private java.util.Map<SqlOperator,CallImplementor>
map
static ConstantExpression
NULL_EXPR
static ConstantExpression
TRUE_EXPR
private java.util.Map<SqlAggFunction,java.util.function.Supplier<? extends WinAggImplementor>>
winAggMap
-
Constructor Summary
Constructors Constructor Description RexImpTable()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static <E> boolean
allSame(java.util.List<E> list)
private static RexCall
call2(boolean harmonize, RexToLixTranslator translator, RexCall call)
private <T> java.util.function.Supplier<T>
constructorSupplier(java.lang.Class<T> klass)
static CallImplementor
createImplementor(NotNullImplementor implementor, NullPolicy nullPolicy, boolean harmonize)
private void
defineBinary(SqlOperator operator, ExpressionType expressionType, NullPolicy nullPolicy, java.lang.String backupMethodName)
private void
defineImplementor(SqlOperator operator, NullPolicy nullPolicy, NotNullImplementor implementor, boolean harmonize)
private void
defineMethod(SqlOperator operator, java.lang.reflect.Method method, NullPolicy nullPolicy)
private void
defineMethod(SqlOperator operator, java.lang.String functionName, NullPolicy nullPolicy)
private void
defineMethodReflective(SqlOperator operator, java.lang.reflect.Method method, NullPolicy nullPolicy)
private void
defineUnary(SqlOperator operator, ExpressionType expressionType, NullPolicy nullPolicy)
AggImplementor
get(SqlAggFunction aggregation, boolean forWindowAggregate)
CallImplementor
get(SqlOperator operator)
(package private) static Expression
getDefaultValue(java.lang.reflect.Type type)
private static long
getFactor(org.apache.calcite.avatica.util.TimeUnit unit)
private static java.util.List<RexNode>
harmonize(RexToLixTranslator translator, java.util.List<RexNode> operands)
Ensures that operands have identical type.private static Expression
implementCall(RexToLixTranslator translator, RexCall call, NotNullImplementor implementor, RexImpTable.NullAs nullAs)
private static Expression
implementNullSemantics(RexToLixTranslator translator, RexCall call, RexImpTable.NullAs nullAs, NullPolicy nullPolicy, NotNullImplementor implementor)
private static Expression
implementNullSemantics0(RexToLixTranslator translator, RexCall call, RexImpTable.NullAs nullAs, NullPolicy nullPolicy, boolean harmonize, NotNullImplementor implementor)
(package private) static Expression
maybeNegate(boolean negate, Expression expression)
private static Expression
mod(Expression operand, long factor)
static Expression
multiplyDivide(Expression e, java.math.BigDecimal multiplier, java.math.BigDecimal divider)
Multiplies an expression by a constant and divides by another constant, optimizing appropriately.private static boolean
nullable(RexCall call, int i)
(package private) static Expression
optimize(Expression expression)
(package private) static Expression
optimize2(Expression operand, Expression expression)
private static RelDataType
toSql(RelDataTypeFactory typeFactory, RelDataType type)
-
-
-
Field Detail
-
NULL_EXPR
public static final ConstantExpression NULL_EXPR
-
FALSE_EXPR
public static final ConstantExpression FALSE_EXPR
-
TRUE_EXPR
public static final ConstantExpression TRUE_EXPR
-
BOXED_FALSE_EXPR
public static final MemberExpression BOXED_FALSE_EXPR
-
BOXED_TRUE_EXPR
public static final MemberExpression BOXED_TRUE_EXPR
-
map
private final java.util.Map<SqlOperator,CallImplementor> map
-
aggMap
private final java.util.Map<SqlAggFunction,java.util.function.Supplier<? extends AggImplementor>> aggMap
-
winAggMap
private final java.util.Map<SqlAggFunction,java.util.function.Supplier<? extends WinAggImplementor>> winAggMap
-
INSTANCE
public static final RexImpTable INSTANCE
-
-
Method Detail
-
constructorSupplier
private <T> java.util.function.Supplier<T> constructorSupplier(java.lang.Class<T> klass)
-
defineImplementor
private void defineImplementor(SqlOperator operator, NullPolicy nullPolicy, NotNullImplementor implementor, boolean harmonize)
-
call2
private static RexCall call2(boolean harmonize, RexToLixTranslator translator, RexCall call)
-
createImplementor
public static CallImplementor createImplementor(NotNullImplementor implementor, NullPolicy nullPolicy, boolean harmonize)
-
defineMethod
private void defineMethod(SqlOperator operator, java.lang.String functionName, NullPolicy nullPolicy)
-
defineMethod
private void defineMethod(SqlOperator operator, java.lang.reflect.Method method, NullPolicy nullPolicy)
-
defineMethodReflective
private void defineMethodReflective(SqlOperator operator, java.lang.reflect.Method method, NullPolicy nullPolicy)
-
defineUnary
private void defineUnary(SqlOperator operator, ExpressionType expressionType, NullPolicy nullPolicy)
-
defineBinary
private void defineBinary(SqlOperator operator, ExpressionType expressionType, NullPolicy nullPolicy, java.lang.String backupMethodName)
-
get
public CallImplementor get(SqlOperator operator)
-
get
public AggImplementor get(SqlAggFunction aggregation, boolean forWindowAggregate)
-
maybeNegate
static Expression maybeNegate(boolean negate, Expression expression)
-
optimize
static Expression optimize(Expression expression)
-
optimize2
static Expression optimize2(Expression operand, Expression expression)
-
nullable
private static boolean nullable(RexCall call, int i)
-
harmonize
private static java.util.List<RexNode> harmonize(RexToLixTranslator translator, java.util.List<RexNode> operands)
Ensures that operands have identical type.
-
toSql
private static RelDataType toSql(RelDataTypeFactory typeFactory, RelDataType type)
-
allSame
private static <E> boolean allSame(java.util.List<E> list)
-
implementNullSemantics0
private static Expression implementNullSemantics0(RexToLixTranslator translator, RexCall call, RexImpTable.NullAs nullAs, NullPolicy nullPolicy, boolean harmonize, NotNullImplementor implementor)
-
implementNullSemantics
private static Expression implementNullSemantics(RexToLixTranslator translator, RexCall call, RexImpTable.NullAs nullAs, NullPolicy nullPolicy, NotNullImplementor implementor)
-
implementCall
private static Expression implementCall(RexToLixTranslator translator, RexCall call, NotNullImplementor implementor, RexImpTable.NullAs nullAs)
-
getDefaultValue
static Expression getDefaultValue(java.lang.reflect.Type type)
-
multiplyDivide
public static Expression multiplyDivide(Expression e, java.math.BigDecimal multiplier, java.math.BigDecimal divider)
Multiplies an expression by a constant and divides by another constant, optimizing appropriately.For example,
multiplyDivide(e, 10, 1000)
returnse / 100
.
-
mod
private static Expression mod(Expression operand, long factor)
-
getFactor
private static long getFactor(org.apache.calcite.avatica.util.TimeUnit unit)
-
-