Class RexProgramFuzzyTest


  • public class RexProgramFuzzyTest
    extends RexProgramBuilderBase
    Validates that RexSimplify is able to deal with randomized RexNode. 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 with RexSimplify)

    • 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
      • DEFAULT_FUZZ_TEST_SEED

        private static final long DEFAULT_FUZZ_TEST_SEED
      • DEFAULT_FUZZ_TEST_DURATION

        private static final java.time.Duration DEFAULT_FUZZ_TEST_DURATION
      • DEFAULT_FUZZ_TEST_ITERATIONS

        private static final long DEFAULT_FUZZ_TEST_ITERATIONS
      • DEFAULT_FUZZ_TEST_FAIL

        private static final boolean DEFAULT_FUZZ_TEST_FAIL
      • slowestTasks

        private java.util.PriorityQueue<SimplifyTask> slowestTasks
      • currentSeed

        private long currentSeed
      • STRONG

        private static final org.apache.calcite.plan.Strong STRONG
    • Constructor Detail

      • RexProgramFuzzyTest

        public RexProgramFuzzyTest()
    • Method Detail

      • testNestedCalls

        public void testNestedCalls()
        Verifies IS 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()