I added those lines to fix https://issues.apache.org/jira/browse/CALCITE-545. 
But I didn’t think about the case where a column was constrained to equal two 
different constants. So I think you’ve found a bug. I think if we find that a 
column has inconsistent constraints then ‘c = x and c = y’ should be changed to 
‘false’.

Can you log a JIRA case please?

Julian


> On Oct 23, 2015, at 1:27 PM, Pengcheng Xiong <[email protected]> wrote:
> 
> In ReduceExpressionRule.java
> 
> L396-397:
> 
> final ImmutableMap<RexNode, RexLiteral> constants =
> 
>        predicateConstants(predicates);
> 
> Basically, my 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 I have predicates [=($0, '12'), isnull($0)], which is the input of the
> predicateConstants, and the function will return me "{$0='12'}"
> 
> May I ask why it is designed in this way to extract only the predicate that
> contains equal to a literal? It appears to me that none of the rows will
> satisfy the predicate and extracting only the predicate that contains equal
> to a literal is not useful and it merely adds more processing overhead.
> 
> 
> Thanks.
> 
> Best
> 
> Pengcheng Xiong

Reply via email to