Julian Hyde created CALCITE-3500:
------------------------------------

             Summary: Validator infers incorrect type for "IS NOT DISTINCT FROM"
                 Key: CALCITE-3500
                 URL: https://issues.apache.org/jira/browse/CALCITE-3500
             Project: Calcite
          Issue Type: Bug
            Reporter: Julian Hyde


Validator infers incorrect type for "IS NOT DISTINCT FROM". I got the following 
output from a test:
{noformat}
[INFO] Running org.apache.calcite.test.fuzzer.RexProgramFuzzyTest
2019-11-13 13:30:16,459 [pool-1-thread-3] INFO  - Using seed 44 for rex fuzzing
2019-11-13 13:30:19,869 [pool-1-thread-3] INFO  - Rex fuzzing results: number 
of cases tested=2000, failed cases=0, duplicate failures=0, fuzz rate=586 per 
second
Shrinked to 36669 chars, time remaining 19997
Shrinked to 9704 chars, time remaining 19996
Shrinked to 9631 chars, time remaining 19993
Shrinked to 9287 chars, time remaining 19992
Shrinked to 7058 chars, time remaining 19989
Shrinked to 6507 chars, time remaining 19986
Shrinked to 5317 chars, time remaining 19985
Shrinked to 5191 chars, time remaining 19985
Shrinked to 4990 chars, time remaining 19984
Shrinked to 4844 chars, time remaining 19984
Shrinked to 3877 chars, time remaining 19981
Shrinked to 3628 chars, time remaining 19981
Shrinked to 275 chars, time remaining 19980
Shrinked to 258 chars, time remaining 19980
Shrinked to 239 chars, time remaining 19980
Shrinked to 188 chars, time remaining 19979
2019-11-13 13:30:20,616 [pool-1-thread-1] INFO  - Rex fuzzing results: number 
of cases tested=406, failed cases=1, duplicate failures=0, fuzz rate=100 per 
second
2019-11-13 13:30:20,617 [pool-1-thread-1] INFO  - Randomized test identified a 
potential defect. Feel free to fix that issue
java.lang.IllegalStateException: Unable to simplify unknownAsFalse<(IS NOT 
DISTINCT FROM(>(+(CAST(0):INTEGER), +(0)), true), true)
lt(isNotDistinctFrom(gt(unaryPlus(abstractCast(literal(0), tInt(true))), 
unaryPlus(literal(0))), trueLiteral), trueLiteral)
        at 
org.apache.calcite.test.fuzzer.RexProgramFuzzyTest.checkUnknownAs(RexProgramFuzzyTest.java:228)
        at 
org.apache.calcite.test.fuzzer.RexProgramFuzzyTest.checkUnknownAsAndShrink(RexProgramFuzzyTest.java:209)
        at 
org.apache.calcite.test.fuzzer.RexProgramFuzzyTest.checkUnknownAs(RexProgramFuzzyTest.java:172)
        at 
org.apache.calcite.test.fuzzer.RexProgramFuzzyTest.generateRexAndCheckTrueFalse(RexProgramFuzzyTest.java:462)
        Suppressed: org.apache.calcite.test.fuzzer.RexProgramFuzzyTest$1: seed 
-104518976443406885
Caused by: java.lang.AssertionError
        at 
org.apache.calcite.rex.RexSimplify.validateStrongPolicy(RexSimplify.java:843)
        at org.apache.calcite.rex.RexSimplify.simplifyIs2(RexSimplify.java:682)
        at org.apache.calcite.rex.RexSimplify.simplifyIs(RexSimplify.java:653)
        at org.apache.calcite.rex.RexSimplify.simplify(RexSimplify.java:281)
{noformat}

I believe that it means that a particular call to {{IS NOT DISTINCT FROM}} has 
a not-null return and has nullable arguments and this contradict's the 
Strong.ANY policy. I suspect that the policy for that operator should not be 
Strong.ANY.

Discovered by the {{validateStrongPolicy}} method added in CALCITE-3457.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to