Ruben Quesada Lopez created CALCITE-2894:
--------------------------------------------
Summary: NullPointerException thrown by
RelMdPercentageOriginalRows when explaining plan with all attributes
Key: CALCITE-2894
URL: https://issues.apache.org/jira/browse/CALCITE-2894
Project: Calcite
Issue Type: Bug
Affects Versions: 1.18.0
Reporter: Ruben Quesada Lopez
{{RelMdPercentageOriginalRows}} methods use several times {{double}} variables
to store the result of {{getPercentageOriginalRows}}. However, this method
returns an object {{Double}}, as {{RelMetadataQuery#getPercentageOriginalRows}}
javadoc says: "return estimated percentage (between 0.0 and 1.0), *or null if
no reliable estimate can be determined*".
Therefore, {{null}} can (and will) be returned in some cases, leading to
NullPointerException.
In my case, I arrived to the situation by explaining a plan (including all
attributes) that contained a SemiJoin, with an Union inside, with a Correlate
inside:
{code:java}
@Test public void testExplainAllAttributesSemiJoinUnionCorrelate() {
CalciteAssert.that()
.with(CalciteConnectionProperty.LEX, Lex.JAVA)
.with(CalciteConnectionProperty.FORCE_DECORRELATE, false)
.withSchema("s", new ReflectiveSchema(new JdbcTest.HrSchema()))
.query(
"select deptno, name from depts where deptno in (\n"
+ " select e.deptno from emps e where exists
(select 1 from depts d where d.deptno=e.deptno)\n"
+ " union select e.deptno from emps e where
e.salary > 10000) ")
.explainMatches("including all attributes ",
CalciteAssert.checkResultContains("EnumerableSemiJoin"));
}
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)