[ https://issues.apache.org/jira/browse/CALCITE-2292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16825790#comment-16825790 ]
Chunwei Lei edited comment on CALCITE-2292 at 4/25/19 7:21 AM: --------------------------------------------------------------- I think it always return {{null}} for {{(inp1_ == null || inp1_ != null ? (Boolean) null : Boolean.TRUE)}} which is not expected. The test as follows can reproduce the issue. {code:java} sql("filterable-model", "select name from EMPS where name not like '%F%' and name like '%W%'").returns("NAME=Wilma; EMPNO=120").ok();{code} was (Author: chunwei lei): I think it always return {{null}} for {{(inp1_ == null || inp1_ != null ? (Boolean) null : Boolean.TRUE)}} which is not expected. But it is interesting that the test as follows shows the result is correct. {code:java} sql("filterable-model", "select name from EMPS where name not like '%F%' and name like '%W%'").returns("NAME=Wilma; EMPNO=120").ok();{code} Maybe I miss something. > 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 > Priority: Major > Attachments: image-2018-05-01-23-20-57-853.png > > > 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)