Package org.apache.calcite.test.fuzzer
Class RexProgramFuzzyTest
- java.lang.Object
-
- org.apache.calcite.test.RexProgramBuilderBase
-
- org.apache.calcite.test.fuzzer.RexProgramFuzzyTest
-
public class RexProgramFuzzyTest extends RexProgramBuilderBase
Validates thatRexSimplify
is able to deal with randomizedRexNode
. Note: the default fuzzing time is 5 seconds to keep overall test duration reasonable. The test starts from a random point every time, so the longer it runs the more errors it detects.Note: The test is not included to
CalciteSuite
since it would fail every build (there are lots of issues withRexSimplify
)
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
RexProgramFuzzyTest.TopN<E extends java.lang.Comparable<E>>
A bounded variation ofPriorityQueue
-
Field Summary
Fields Modifier and Type Field Description private long
currentSeed
protected static org.slf4j.Logger
LOGGER
private static int
MAX_FAILURES
private static long
SEED
private java.util.PriorityQueue<SimplifyTask>
slowestTasks
private static org.apache.calcite.plan.Strong
STRONG
private static java.time.Duration
TEST_DURATION
private static long
TEST_ITERATIONS
private static int
TOPN_SLOWEST
-
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 RexProgramFuzzyTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkUnknownAs(org.apache.calcite.rex.RexNode node)
private void
checkUnknownAs(org.apache.calcite.rex.RexNode node, org.apache.calcite.rex.RexUnknownAs unknownAs)
void
defaultFuzzTest()
private void
generateRexAndCheckTrueFalse(RexFuzzer fuzzer, java.util.Random r)
private void
nestedCalls(org.apache.calcite.rex.RexNode arg)
private static java.lang.String
nodeToString(org.apache.calcite.rex.RexNode node)
private void
runRexFuzzer(long startSeed, java.time.Duration testDuration, int maxFailures, long testIterations, int topnSlowest)
void
setUp()
void
singleFuzzyTest()
void
testFuzzy()
void
testNestedCalls()
VerifiesIS TRUE(IS NULL(null))
kind of expressions up to 4 level deep.private static void
trimStackTrace(java.lang.Throwable t, int maxStackLines)
private java.lang.String
unknownAsString(org.apache.calcite.rex.RexUnknownAs unknownAs)
-
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, sub, tBoolean, tBoolean, tInt, tInt, tVarchar, tVarchar, unaryMinus, unaryPlus, vBool, vBool, vBoolNotNull, vBoolNotNull, vInt, vInt, vIntNotNull, vIntNotNull, vVarchar, vVarchar, vVarcharNotNull, vVarcharNotNull
-
-
-
-
Field Detail
-
LOGGER
protected static final org.slf4j.Logger LOGGER
-
TEST_DURATION
private static final java.time.Duration TEST_DURATION
-
TEST_ITERATIONS
private static final long TEST_ITERATIONS
-
MAX_FAILURES
private static final int MAX_FAILURES
-
TOPN_SLOWEST
private static final int TOPN_SLOWEST
-
SEED
private static final long SEED
-
slowestTasks
private java.util.PriorityQueue<SimplifyTask> slowestTasks
-
currentSeed
private long currentSeed
-
STRONG
private static final org.apache.calcite.plan.Strong STRONG
-
-
Method Detail
-
setUp
public void setUp()
- Overrides:
setUp
in classRexProgramBuilderBase
-
testNestedCalls
public void testNestedCalls()
VerifiesIS TRUE(IS NULL(null))
kind of expressions up to 4 level deep.
-
nestedCalls
private void nestedCalls(org.apache.calcite.rex.RexNode arg)
-
checkUnknownAs
private void checkUnknownAs(org.apache.calcite.rex.RexNode node)
-
checkUnknownAs
private void checkUnknownAs(org.apache.calcite.rex.RexNode node, org.apache.calcite.rex.RexUnknownAs unknownAs)
-
unknownAsString
@Nonnull private java.lang.String unknownAsString(org.apache.calcite.rex.RexUnknownAs unknownAs)
-
nodeToString
private static java.lang.String nodeToString(org.apache.calcite.rex.RexNode node)
-
trimStackTrace
private static void trimStackTrace(java.lang.Throwable t, int maxStackLines)
-
defaultFuzzTest
public void defaultFuzzTest()
-
testFuzzy
public void testFuzzy()
-
runRexFuzzer
private void runRexFuzzer(long startSeed, java.time.Duration testDuration, int maxFailures, long testIterations, int topnSlowest)
-
generateRexAndCheckTrueFalse
private void generateRexAndCheckTrueFalse(RexFuzzer fuzzer, java.util.Random r)
-
singleFuzzyTest
public void singleFuzzyTest()
-
-