[ 
https://issues.apache.org/jira/browse/CALCITE-935?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14972839#comment-14972839
 ] 

Julian Hyde commented on CALCITE-935:
-------------------------------------

I reviewed your changes. I tidied up by gathering the code into a method, and 
using a multimap to defer detecting duplicates. I also added a test case. The 
test case shows that if you have a non-equi constraint, say 'mgr is null' then 
it prevents any constant reduction occurring. That is not OK. Constraints which 
are not 'column = constant' (and that includes constraints 'column = constant1 
and column = constant2') should be ignored, but they should not prevent 
constant reduction.

Can you build on the work in 
https://github.com/julianhyde/incubator-calcite/tree/935-reduce-multiple-constraints
 and make sure that testReduceConstantsDup2 reduces empno to 10 and ignores the 
constraints on deptno and mgr. (If you reduce mgr to null I wouldn't object.)

> Improve ReduceExpressionRule to deal with multiple "equals to literal" in 
> predicate
> -----------------------------------------------------------------------------------
>
>                 Key: CALCITE-935
>                 URL: https://issues.apache.org/jira/browse/CALCITE-935
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Pengcheng Xiong
>            Assignee: Julian Hyde
>         Attachments: CALCITE-935.01.patch
>
>
> In ReduceExpressionRule.java,
> L396-397:
> final ImmutableMap<RexNode, RexLiteral> constants =
>        predicateConstants(predicates);
> The query is "select * from src where (key='12' and key is
> null);" Here 'key' is a string type and it is one of the columns of 'src'
> table.
> Then we will have predicates [=($0, '12'), isnull($0)], which is the input of 
> the
> predicateConstants, and the function will return "{$0='12'}"



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to