[
https://issues.apache.org/jira/browse/CALCITE-2687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16693176#comment-16693176
]
Zoltan Haindrich commented on CALCITE-2687:
-------------------------------------------
Actually it seems like this was entirely avoided before CALCITE-2675
Note: I don't feel it right that simplification collapses {{CAST(null):INTEGER
NOT NULL}} to {{null}}
I would like to propose to change the translation rules of isDistinctFrom to a
more null safe one - which doesn't need casts.
> 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
> Priority: Major
>
> 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)