[
https://issues.apache.org/jira/browse/CALCITE-6422?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde updated CALCITE-6422:
---------------------------------
Summary: Query with '<>' throws NullPointerException during materialized
view matching (was: NPE in RexLiteral.booleanValue of
SubstitutionVisitor.mayBeSatisfiable when materialized view query contains NEQ
on nullable column)
> Query with '<>' throws NullPointerException during materialized view matching
> -----------------------------------------------------------------------------
>
> 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
> Labels: pull-request-available
>
> If a materialized view compares two nullable columns using '=', and a query
> on that materialized view compares the same column using '<>',
> {{SubstitutionVisitor.mayBeSatisfiable}} causes {{RexLiteral.booleanValue}}
> to throw a {{NullPointerException}}.
> 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)