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

Chunwei Lei commented on CALCITE-2292:
--------------------------------------

I opened a PR: [https://github.com/apache/calcite/pull/1182].

> Query result is wrong when table is implemented with FilterableTable and the 
> sql has multiple where conditions
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2292
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2292
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.16.0
>         Environment: version 1.16.0
>            Reporter: cnzhujie
>            Assignee: Chunwei Lei
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: image-2018-05-01-23-20-57-853.png
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> you can reappearance this bug in test case 
> `org.apache.calcite.test.CsvTest#testFilterableSelect`.
>  
> Try execute this sql:
> {code:java}
> sql("filterable-model", "select name from EMPS where name not like '%F%' and 
> name like '%e%'").ok();
> {code}
> The code generate in method 
> `org.apache.calcite.interpreter.JaninoRexCompiler#compile`
> !image-2018-05-01-23-20-57-853.png!
> {code:java}
> {
> final Object[] current = context.values;
> final String inp1_ = current[1] == null ? (String) null : 
> current[1].toString();
> outputValues[0] = (inp1_ == null || 
> org.apache.calcite.runtime.SqlFunctions.like(inp1_, "%e%")) && !(inp1_ != 
> null && org.apache.calcite.runtime.SqlFunctions.like(inp1_, "%F%")) ? (inp1_ 
> == null || inp1_ != null ? (Boolean) null : Boolean.TRUE) : Boolean.FALSE;
> }
> {code}
> This bug can be reappearanced in 1.17.0-SNAPSHOT、1.16.0、1.13.0
>  



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

Reply via email to