[
https://issues.apache.org/jira/browse/CALCITE-4136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17162817#comment-17162817
]
Ruben Q L edited comment on CALCITE-4136 at 7/22/20, 1:45 PM:
--------------------------------------------------------------
I can reproduce the issue on Calcite master, if we use a deprecated rule in a
test, we get a NPE (we need to remove temporarily the "deprecated" from the old
rule, otherwise we will not be able to use it).
For example, in
{{EnumerableCorrelateTest#semiJoinCorrelateWithFilterCorrelateRule}}:
{code}
@Test void semiJoinCorrelateWithFilterCorrelateRule() {
tester(false, new JdbcTest.HrSchema())
.query(
"select empid, name from emps e where e.deptno in (select d.deptno
from depts d) and e.empid > 100")
.withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> {
...
// Use FilterCorrelateRule.INSTANCE instead of
CoreRules.FILTER_CORRELATE
//planner.addRule(CoreRules.FILTER_CORRELATE);
planner.addRule(FilterCorrelateRule.INSTANCE);
...
{code}
Causes:
{code}
java.sql.SQLException: Error while executing SQL "explain plan for select
empid, name from emps e where e.deptno in (select d.deptno from depts d) and
e.empid > 100": null
at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
...
Caused by: java.lang.NullPointerException
at
org.apache.calcite.plan.AbstractRelOptPlanner.addRule(AbstractRelOptPlanner.java:147)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.addRule(VolcanoPlanner.java:416)
at
org.apache.calcite.test.enumerable.EnumerableCorrelateTest.lambda$semiJoinCorrelateWithFilterCorrelateRule$2(EnumerableCorrelateTest.java:125)
at org.apache.calcite.runtime.Hook.run(Hook.java:190)
{code}
was (Author: rubenql):
I can reproduce the issue on Calcite, if we use a deprecated rule in a test, we
get a NPE (we need to remove temporarily the "deprecated" from the old rule,
otherwise we will not be able to use it).
For example, in
{{EnumerableCorrelateTest#semiJoinCorrelateWithFilterCorrelateRule}}:
{code}
@Test void semiJoinCorrelateWithFilterCorrelateRule() {
tester(false, new JdbcTest.HrSchema())
.query(
"select empid, name from emps e where e.deptno in (select d.deptno
from depts d) and e.empid > 100")
.withHook(Hook.PLANNER, (Consumer<RelOptPlanner>) planner -> {
...
// Use FilterCorrelateRule.INSTANCE instead of
CoreRules.FILTER_CORRELATE
//planner.addRule(CoreRules.FILTER_CORRELATE);
planner.addRule(FilterCorrelateRule.INSTANCE);
...
{code}
Causes:
{code}
java.sql.SQLException: Error while executing SQL "explain plan for select
empid, name from emps e where e.deptno in (select d.deptno from depts d) and
e.empid > 100": null
at org.apache.calcite.avatica.Helper.createException(Helper.java:56)
...
Caused by: java.lang.NullPointerException
at
org.apache.calcite.plan.AbstractRelOptPlanner.addRule(AbstractRelOptPlanner.java:147)
at
org.apache.calcite.plan.volcano.VolcanoPlanner.addRule(VolcanoPlanner.java:416)
at
org.apache.calcite.test.enumerable.EnumerableCorrelateTest.lambda$semiJoinCorrelateWithFilterCorrelateRule$2(EnumerableCorrelateTest.java:125)
at org.apache.calcite.runtime.Hook.run(Hook.java:190)
{code}
> ReduceExpressionsRule.FILTER_INSTANCE cannot be initialized by some JVM
> -----------------------------------------------------------------------
>
> Key: CALCITE-4136
> URL: https://issues.apache.org/jira/browse/CALCITE-4136
> Project: Calcite
> Issue Type: Bug
> Components: core
> Reporter: Stamatis Zampetakis
> Priority: Major
> Attachments: DeprecatedRulesAreNull.png
>
>
> In certain JVM implementations the field cannot be initialized leading to
> {{NullPointerException}} when using the rule.
> Few stacktraces are given below:
> {noformat}
> Caused by: java.lang.NullPointerException: at index 0
> at
> com.onwbp.com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:239)
> at
> com.onwbp.com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:230)
> at
> com.onwbp.com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:225)
> at
> com.onwbp.com.google.common.collect.ImmutableList.construct(ImmutableList.java:281)
> at
> com.onwbp.com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:239)
> at
> com.onwbp.com.google.common.collect.ImmutableList.copyOf(ImmutableList.java:209)
> at com.onwbp.org.apache.calcite.tools.RuleSets.ofList(RuleSets.java:41)
> {noformat}
> {noformat}
> java.lang.NullPointerException
> at
> org.apache.calcite.plan.AbstractRelOptPlanner.addRule(AbstractRelOptPlanner.java:147)
> at
> org.apache.calcite.plan.volcano.VolcanoPlanner.addRule(VolcanoPlanner.java:416)
> at herddb.sql.CalcitePlanner.runPlanner(CalcitePlanner.java:576)
> at herddb.sql.CalcitePlanner.translate(CalcitePlanner.java:331)
> at herddb.core.TestUtils.scan(TestUtils.java:70)
> {noformat}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)