[ https://issues.apache.org/jira/browse/CALCITE-2466?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16580180#comment-16580180 ]
Shuyi Chen commented on CALCITE-2466: ------------------------------------- Thanks a lot, [~julianhyde], in {code:java} select deptno from dept_nested where NAME <> '' AND employees <> null {code}, if NAME is empty string and employees is a valid array (non null), then it should not return empty row, right? > 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)