You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zoltan Haindrich (JIRA)" <ji...@apache.org> on 2018/11/20 12:30:00 UTC

[jira] [Created] (CALCITE-2687) Is distinct from could lead to Exceptions in ReduceExpressionRule

Zoltan Haindrich created CALCITE-2687:
-----------------------------------------

             Summary: Is distinct from could lead to Exceptions in ReduceExpressionRule
                 Key: CALCITE-2687
                 URL: https://issues.apache.org/jira/browse/CALCITE-2687
             Project: Calcite
          Issue Type: Bug
            Reporter: Zoltan Haindrich
            Assignee: Zoltan Haindrich


Test:
{code}
  @Test
  public void testReduceConstants4() throws Exception {
    HepProgram program = new HepProgramBuilder()
        .addRuleInstance(ReduceExpressionsRule.PROJECT_INSTANCE)
        .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE)
        .addRuleInstance(ReduceExpressionsRule.JOIN_INSTANCE)
        .build();

    String sql = "select e.mgr is not distinct from f.mgr from emp e join emp f on (e.mgr=f.mgr) where e.mgr is null";
    sql(sql).with(program)
        .check();
  }
{code}

Unfortunately the exception doesn't have a stacktrace by default; just some type:
{code}
org.apache.calcite.adapter.enumerable.RexToLixTranslator$AlwaysNull
{code}

Translation is not possible at this point: https://github.com/apache/calcite/blob/d32ee5c320938b5c34ce09df2276c9570c27a301/core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java#L746

the underlying rexNode is:
{code}
CAST(null):INTEGER NOT NULL
{code}
which is problematic



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)