[ https://issues.apache.org/jira/browse/CALCITE-2466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16580119#comment-16580119 ]
Julian Hyde commented on CALCITE-2466: -------------------------------------- It seems correct that that query returns 0 rows. What do you think it should return? > RexSimplify incorrectly simplify conjunction statement with null literal > ------------------------------------------------------------------------ > > Key: CALCITE-2466 > URL: https://issues.apache.org/jira/browse/CALCITE-2466 > Project: Calcite > Issue Type: Bug > Components: core > Reporter: Shuyi Chen > Assignee: Julian Hyde > Priority: Major > Fix For: 1.18.0 > > > This can be reproduced using the following test: > {code:java} > @Test public void testFilterReduction() throws Exception { > HepProgramBuilder programBuilder = HepProgram.builder(); > programBuilder.addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE); > HepPlanner planner = new HepPlanner(programBuilder.build()); > final String sql = "select deptno from dept_nested where NAME <> '' AND > employees <> null"; > planner.setRoot(tester.convertSqlToRel(sql).rel); > RelNode bestRel = planner.findBestExp(); > assertEquals( > "LogicalProject(DEPTNO=[$0])\n" + > " LogicalFilter(condition=[AND(<>($1, ''), <>($3, null))])\n" + > " LogicalTableScan(table=[[CATALOG, SALES, DEPT_NESTED]])\n", > RelOptUtil.toString(bestRel)); > } > {code} > In this test, > {code:java} > NAME <> '' AND employees <> null > {code} is always evaluated to false incorrectly, so the optimized plan is > {code:java} > LogicalProject(DEPTNO=[$0]) > LogicalValues(tuples=[[]]) > {code}. -- This message was sent by Atlassian JIRA (v7.6.3#76005)