You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Thomas Rebele (Jira)" <ji...@apache.org> on 2020/09/14 17:36:00 UTC

[jira] [Created] (CALCITE-4256) RexSimplify should not simplify P AND P to P, if it contains a call to RAND or RAND_INTEGER

Thomas Rebele created CALCITE-4256:
--------------------------------------

             Summary: RexSimplify should not simplify P AND P to P, if it contains a call to RAND or RAND_INTEGER
                 Key: CALCITE-4256
                 URL: https://issues.apache.org/jira/browse/CALCITE-4256
             Project: Calcite
          Issue Type: Bug
            Reporter: Thomas Rebele


Example: RAND_INTEGER() = 1 AND RAND_INTEGER() = 1 is false with a higher probability than RAND_INTEGER() = 1

Here a test case for RexProgramTest:
{code}
@Test void testSimplifyRandomAnd() {
    checkSimplifyUnchanged(
        and(
            eq(rexBuilder.makeCall(SqlStdOperatorTable.RAND_INTEGER), literal(1)),
            eq(rexBuilder.makeCall(SqlStdOperatorTable.RAND_INTEGER), literal(1))
        ));
  }
{code}



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