[ https://issues.apache.org/jira/browse/CALCITE-6422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Mou Wu updated CALCITE-6422: ---------------------------- Description: Add the test case in MaterializedViewRelOptRulesTest to reproduce this bug: {code:java} @Test public void testNpeInSplitFilterOfSubstitutionVisitor() { sql("select \"col1\", \"col2\"" + " from \"nullables\"" + " where \"col1\" <> \"col2\" and \"col3\" = 1", "select \"col1\", \"col2\"" + " from \"nullables\"" + " where \"col1\" = \"col2\" and \"col3\" = 1") .checkingThatResultContains("" + "EnumerableCalc(expr#0..2=[{inputs}], expr#3=[=($t0, $t1)], expr#4=[CAST($t2):INTEGER NOT NULL], expr#5=[1], expr#6=[=($t4, $t5)], expr#7=[AND($t3, $t6)], proj#0..1=[{exprs}], $condition=[$t7])\n" + " EnumerableTableScan(table=[[hr, nullables]])") .ok(); } {code} A NPE will be thrown. Notes: col1 and col2 of table nullables should be nullable. > RexLiteral.isNullLiteral should be called before RexLiteral.booleanValue in > SubstitutionVisitor.mayBeSatisfiable > ---------------------------------------------------------------------------------------------------------------- > > Key: CALCITE-6422 > URL: https://issues.apache.org/jira/browse/CALCITE-6422 > Project: Calcite > Issue Type: Bug > Reporter: Mou Wu > Assignee: Mou Wu > Priority: Major > > Add the test case in MaterializedViewRelOptRulesTest to reproduce this bug: > > {code:java} > @Test public void testNpeInSplitFilterOfSubstitutionVisitor() { > sql("select \"col1\", \"col2\"" > + " from \"nullables\"" > + " where \"col1\" <> \"col2\" and \"col3\" = 1", > "select \"col1\", \"col2\"" > + " from \"nullables\"" > + " where \"col1\" = \"col2\" and \"col3\" = 1") > .checkingThatResultContains("" > + "EnumerableCalc(expr#0..2=[{inputs}], expr#3=[=($t0, $t1)], > expr#4=[CAST($t2):INTEGER NOT NULL], expr#5=[1], expr#6=[=($t4, $t5)], > expr#7=[AND($t3, $t6)], proj#0..1=[{exprs}], $condition=[$t7])\n" > + " EnumerableTableScan(table=[[hr, nullables]])") > .ok(); > } {code} > A NPE will be thrown. > Notes: col1 and col2 of table nullables should be nullable. > -- This message was sent by Atlassian Jira (v8.20.10#820010)