Package org.apache.calcite.test.fuzzer
Class RexFuzzer
- java.lang.Object
-
- org.apache.calcite.test.RexProgramBuilderBase
-
- org.apache.calcite.test.fuzzer.RexFuzzer
-
public class RexFuzzer extends RexProgramBuilderBase
Generates randomRexNode
instances for tests.
-
-
Field Summary
Fields Modifier and Type Field Description private static org.apache.calcite.sql.SqlOperator[]
ANY_SAME_TYPE_MULTI_ARG
private static org.apache.calcite.sql.SqlOperator[]
ANY_TO_BOOL
private static org.apache.calcite.sql.SqlOperator[]
BOOL_TO_BOOL
private static org.apache.calcite.sql.SqlOperator[]
BOOL_TO_BOOL_MULTI_ARG
private static org.apache.calcite.sql.SqlOperator[]
COMPARABLE_TO_BOOL
private static int[]
INT_VALUES
private org.apache.calcite.rel.type.RelDataType
intType
private static int
MAX_VARS
private org.apache.calcite.rel.type.RelDataType
nullableIntType
private static org.apache.calcite.sql.SqlOperator[]
NUMERIC_TO_NUMERIC
private static org.apache.calcite.sql.SqlOperator[]
UNARY_NUMERIC
-
Fields inherited from class org.apache.calcite.test.RexProgramBuilderBase
executor, falseLiteral, MAX_FIELDS, nullBool, nullInt, nullVarchar, rexBuilder, simplify, trueLiteral, typeFactory
-
-
Constructor Summary
Constructors Constructor Description RexFuzzer(org.apache.calcite.rex.RexBuilder rexBuilder, org.apache.calcite.adapter.java.JavaTypeFactory typeFactory)
Generates randomizedRexNode
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.calcite.rex.RexNode
fuzzCase(java.util.Random r, int depth, java.util.function.Function<java.util.Random,org.apache.calcite.rex.RexNode> resultFactory)
private org.apache.calcite.rex.RexNode
fuzzOperator(java.util.Random r, org.apache.calcite.sql.SqlOperator[] operators, int length, java.util.function.Function<java.util.Random,org.apache.calcite.rex.RexNode> factory)
private org.apache.calcite.rex.RexNode
fuzzOperator(java.util.Random r, org.apache.calcite.sql.SqlOperator[] operators, org.apache.calcite.rex.RexNode... args)
org.apache.calcite.rex.RexNode
getBoolExpression(java.util.Random r, int depth)
org.apache.calcite.rex.RexNode
getComparableExpression(java.util.Random r, int depth)
org.apache.calcite.rex.RexNode
getExpression(java.util.Random r, int depth)
org.apache.calcite.rex.RexNode
getIntExpression(java.util.Random r, int depth)
org.apache.calcite.rex.RexNode
getSimpleBool(java.util.Random r)
org.apache.calcite.rex.RexNode
getSimpleInt(java.util.Random r)
-
Methods inherited from class org.apache.calcite.test.RexProgramBuilderBase
abstractCast, add, and, and, case_, case_, cast, coalesce, div, divInt, eq, ge, gt, in, input, isDistinctFrom, isFalse, isNotDistinctFrom, isNotFalse, isNotNull, isNotTrue, isNull, isTrue, isUnknown, le, literal, literal, literal, literal, literal, literal, literal, lt, mul, ne, not, null_, nullable, nullIf, or, or, plus, setUp, sub, tBoolean, tBoolean, tInt, tInt, tVarchar, tVarchar, unaryMinus, unaryPlus, vBool, vBool, vBoolNotNull, vBoolNotNull, vInt, vInt, vIntNotNull, vIntNotNull, vVarchar, vVarchar, vVarcharNotNull, vVarcharNotNull
-
-
-
-
Field Detail
-
MAX_VARS
private static final int MAX_VARS
- See Also:
- Constant Field Values
-
BOOL_TO_BOOL
private static final org.apache.calcite.sql.SqlOperator[] BOOL_TO_BOOL
-
ANY_TO_BOOL
private static final org.apache.calcite.sql.SqlOperator[] ANY_TO_BOOL
-
COMPARABLE_TO_BOOL
private static final org.apache.calcite.sql.SqlOperator[] COMPARABLE_TO_BOOL
-
BOOL_TO_BOOL_MULTI_ARG
private static final org.apache.calcite.sql.SqlOperator[] BOOL_TO_BOOL_MULTI_ARG
-
ANY_SAME_TYPE_MULTI_ARG
private static final org.apache.calcite.sql.SqlOperator[] ANY_SAME_TYPE_MULTI_ARG
-
NUMERIC_TO_NUMERIC
private static final org.apache.calcite.sql.SqlOperator[] NUMERIC_TO_NUMERIC
-
UNARY_NUMERIC
private static final org.apache.calcite.sql.SqlOperator[] UNARY_NUMERIC
-
INT_VALUES
private static final int[] INT_VALUES
-
intType
private final org.apache.calcite.rel.type.RelDataType intType
-
nullableIntType
private final org.apache.calcite.rel.type.RelDataType nullableIntType
-
-
Method Detail
-
getExpression
public org.apache.calcite.rex.RexNode getExpression(java.util.Random r, int depth)
-
fuzzOperator
private org.apache.calcite.rex.RexNode fuzzOperator(java.util.Random r, org.apache.calcite.sql.SqlOperator[] operators, org.apache.calcite.rex.RexNode... args)
-
fuzzOperator
private org.apache.calcite.rex.RexNode fuzzOperator(java.util.Random r, org.apache.calcite.sql.SqlOperator[] operators, int length, java.util.function.Function<java.util.Random,org.apache.calcite.rex.RexNode> factory)
-
getComparableExpression
public org.apache.calcite.rex.RexNode getComparableExpression(java.util.Random r, int depth)
-
getSimpleBool
public org.apache.calcite.rex.RexNode getSimpleBool(java.util.Random r)
-
getBoolExpression
public org.apache.calcite.rex.RexNode getBoolExpression(java.util.Random r, int depth)
-
getSimpleInt
public org.apache.calcite.rex.RexNode getSimpleInt(java.util.Random r)
-
getIntExpression
public org.apache.calcite.rex.RexNode getIntExpression(java.util.Random r, int depth)
-
fuzzCase
public org.apache.calcite.rex.RexNode fuzzCase(java.util.Random r, int depth, java.util.function.Function<java.util.Random,org.apache.calcite.rex.RexNode> resultFactory)
-
-