To whom it might concern, it seems like there's either a bug in RexProgramFuzzyTest or there's a bug in RexSimplify (JDK11, git ca6dc99a4625b9d2708f73b523da3dd41d71f73b):
2019-05-24 18:21:17,850 [pool-1-thread-14] INFO - Randomized test identified a potential defect. Feel free to fix that issue java.lang.AssertionError: IS NOT NULL(COALESCE(CASE(OR(?0.notNullBool0, OR(false, true), CASE(?0.bool1, ?0.notNullBool0, ?0.bool1)), CASE(IS TRUE(true), *(COALESCE(CAST(0):INTEGER, ?0.int1, null:INTEGER), COALESCE(?0.int1, 1)), +(CASE(false, null:INTEGER, null:INTEGER), -(?0.notNullInt1))), CASE(=(null, ?0.int1), NOT(true), =(null, 1188571884), =(true, false), IS NOT NULL(CAST(100500):INTEGER)), COALESCE(?0.notNullInt0, *(-(CAST(1):INTEGER, null), -(-1))), IS NOT UNKNOWN(IS FALSE(true)), -(COALESCE(*(CAST(1):INTEGER, null), CASE(=(false, false), ?0.int1, CAST(0):INTEGER), +(CAST(-1):INTEGER, 841473781), ?0.int0)), +(CASE(=(true, false), ?0.notNullInt1, =(true, ?0.notNullBool0), +(null:INTEGER, null:INTEGER), =(true, true), CASE(=(?0.bool0, ?0.bool0), -1, ?0.notNullInt1), CASE(=(false, ?0.notNullBool1), 1, null:INTEGER)), COALESCE(?0.int1, 1, null:INTEGER, -1270995326))), COALESCE(-(COALESCE(-(?0.int1, null), +(-1), COALESCE(0, null:INTEGER, 999268530))), COALESCE(+(null:INTEGER), COALESCE(CASE(true, CAST(-1):INTEGER, CAST(1):INTEGER), COALESCE(?0.notNullInt0, null:INTEGER, null:INTEGER, CAST(100500):INTEGER), -(100500, ?0.notNullInt0)), COALESCE(*(?0.int0, CAST(0):INTEGER), CASE(=(false, ?0.bool1), -1, null:INTEGER), -(CAST(238915237):INTEGER), +(null, ?0.int1))), -(CASE(false, ?0.notNullInt1, false, +(0, -1), ?0.notNullBool0, CASE(false, CAST(1):INTEGER, -1), +(null:INTEGER))), CAST(1211100749):INTEGER), COALESCE(-(null:INTEGER), *(COALESCE(+(?0.notNullInt1), COALESCE(?0.notNullInt1, null:INTEGER)), COALESCE(-(?0.int1), CAST(-658744959):INTEGER))))) isNotNull(coalesce(case_(or(vBoolNotNull(0), or(falseLiteral, trueLiteral), case_(vBool(1), vBoolNotNull(0), vBool(1))), case_(isTrue(trueLiteral), rexBuilder.makeCall(SqlStdOperatorTable.*, coalesce(rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(0)), vInt(1), nullInt), coalesce(vInt(1), literal(1))), plus(case_(falseLiteral, nullInt, nullInt), unaryMinus(vIntNotNull(1)))), case_(eq(nullInt, vInt(1)), not(trueLiteral), eq(nullInt, literal(1188571884)), eq(trueLiteral, falseLiteral), isNotNull(rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(100500)))), coalesce(vIntNotNull(0), rexBuilder.makeCall(SqlStdOperatorTable.*, sub(rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(1)), nullInt), unaryMinus(literal(-1)))), rexBuilder.makeCall(SqlStdOperatorTable.IS_NOT_UNKNOWN, isFalse(trueLiteral)), unaryMinus(coalesce(rexBuilder.makeCall(SqlStdOperatorTable.*, rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(1)), nullInt), case_(eq(falseLiteral, falseLiteral), vInt(1), rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(0))), plus(rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(-1)), literal(841473781)), vInt(0))), plus(case_(eq(trueLiteral, falseLiteral), vIntNotNull(1), eq(trueLiteral, vBoolNotNull(0)), plus(nullInt, nullInt), eq(trueLiteral, trueLiteral), case_(eq(vBool(0), vBool(0)), literal(-1), vIntNotNull(1)), case_(eq(falseLiteral, vBoolNotNull(1)), literal(1), nullInt)), coalesce(vInt(1), literal(1), nullInt, literal(-1270995326)))), coalesce(unaryMinus(coalesce(sub(vInt(1), nullInt), unaryPlus(literal(-1)), coalesce(literal(0), nullInt, literal(999268530)))), coalesce(unaryPlus(nullInt), coalesce(case_(trueLiteral, rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(-1)), rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(1))), coalesce(vIntNotNull(0), nullInt, nullInt, rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(100500))), sub(literal(100500), vIntNotNull(0))), coalesce(rexBuilder.makeCall(SqlStdOperatorTable.*, vInt(0), rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(0))), case_(eq(falseLiteral, vBool(1)), literal(-1), nullInt), unaryMinus(rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(238915237))), plus(nullInt, vInt(1)))), unaryMinus(case_(falseLiteral, vIntNotNull(1), falseLiteral, plus(literal(0), literal(-1)), vBoolNotNull(0), case_(falseLiteral, rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(1)), literal(-1)), unaryPlus(nullInt))), rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(1211100749))), coalesce(unaryMinus(nullInt), rexBuilder.makeCall(SqlStdOperatorTable.*, coalesce(unaryPlus(vIntNotNull(1)), coalesce(vIntNotNull(1), nullInt)), coalesce(unaryMinus(vInt(1)), rexBuilder.makeCall(SqlStdOperatorTable.CAST, literal(-658744959))))))) isAlwaysTrue, so it should simplify to TRUE unknownAsFalse expected:<true> but was:<IS NOT NULL(COALESCE(*(0, COALESCE(?0.int1, 1)), -(+(-1))))> at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.failNotEquals(Assert.java:834) at org.junit.Assert.assertEquals(Assert.java:118) at org.apache.calcite.test.fuzzer.RexProgramFuzzyTest.checkUnknownAs(RexProgramFuzzyTest.java:213) Suppressed: org.apache.calcite.test.fuzzer.RexProgramFuzzyTest$1: seed 8655949754118728531 Vladimir
