Vladimir Sitnikov created CALCITE-4678: ------------------------------------------
Summary: AssertionError: result mismatch when simplifying case+search+isdistinctfrom+isnottrue Key: CALCITE-4678 URL: https://issues.apache.org/jira/browse/CALCITE-4678 Project: Calcite Issue Type: Improvement Components: core Reporter: Vladimir Sitnikov Frankly speaking, I do not know what triggers the issue. so the issue summary is abstract for now. I do not know the expected outcome, however, I expect that Calcite should not fail with AssertionErrors. Test case: {code:java} checkSimplifyAs( isNotTrue( case_( rexBuilder.makeCall( SqlStdOperatorTable.SEARCH, vInt(1), rexBuilder.makeSearchArgumentLiteral( Sarg.of( RexUnknownAs.TRUE, ImmutableRangeSet.of(Range.lessThan(BigDecimal.ZERO))), tInt())), trueLiteral, le(trueLiteral, isDistinctFrom(literal(0), literal(0))))), RexUnknownAs.TRUE, is("no idea what is expected")); {code} Error: {noformat} result mismatch (unknown as TRUE): when applied to {?0.int1=NULL}, IS NOT TRUE(CASE(SEARCH(?0.int1, Sarg[(-∞..0); NULL AS TRUE]), true, <=(true, IS DISTINCT FROM(0, 0)))) yielded false; AND(IS NOT DISTINCT FROM(0, 0), >=(?0.int1, 0)) yielded true java.lang.AssertionError: result mismatch (unknown as TRUE): when applied to {?0.int1=NULL}, IS NOT TRUE(CASE(SEARCH(?0.int1, Sarg[(-∞..0); NULL AS TRUE]), true, <=(true, IS DISTINCT FROM(0, 0)))) yielded false; AND(IS NOT DISTINCT FROM(0, 0), >=(?0.int1, 0)) yielded true at org.apache.calcite.rex.RexSimplify.verify(RexSimplify.java:2098) at org.apache.calcite.rex.RexSimplify.simplifyUnknownAs(RexSimplify.java:250) at org.apache.calcite.rex.RexProgramTestBase.checkSimplifyAs(RexProgramTestBase.java:152){noformat} The relevant fuzzer-driven case is {code:java} @Test void singleFuzzyTest() { Random r = new Random(); r.setSeed(6192825841324574146L); RexFuzzer fuzzer = new RexFuzzer(rexBuilder, typeFactory); generateRexAndCheckTrueFalse(fuzzer, r); }{code} -- This message was sent by Atlassian Jira (v8.3.4#803005)