[ 
https://issues.apache.org/jira/browse/CALCITE-4136?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17162694#comment-17162694
 ] 

Ruben Q L edited comment on CALCITE-4136 at 7/22/20, 12:10 PM:
---------------------------------------------------------------

Thanks [~zabetak] for creating this ticket.
In my case I'm on a windows environment with jdk 1.8.0_121 using Calcite 
1.24RC0.
The issue is not just ReduceExpressionsRule.FILTER_INSTANCE, but all the 
deprecated rules seem to be null at runtime. I've checked with the debugger and 
can provide some screenshots (see attachment).
As I said, I use a bunch of deprecated rules in my application 
(FilterCorrelateRule.INSTANCE, SortJoinCopyRule.INSTANCE, 
FilterJoinRule.FILTER_ON_JOIN, SortProjectTransposeRule.INSTANCE, 
FilterMergeRule.INSTANCE, ...) and ALL of them are null at runtime. Looking 
closely, as [~zabetak] suggests, it seems a cyclic dependency initialization 
issue, since I can see in the debugger that the deprecated instances are null, 
even though the newer equivalents that they reference are not:
{code}
// INSTANCE is null
// CoreRules.FILTER_CORRELATE is not null
public static final FilterCorrelateRule INSTANCE = CoreRules.FILTER_CORRELATE;
{code}

I only face this problem on my application that uses Calcite as a library; 
executing Calcite build+tests in the same environment runs successfully.


was (Author: rubenql):
Thanks [~zabetak] for creating this ticket.
In my case I'm on a windows environment with jdk 1.8.0_121.
The issue is not just ReduceExpressionsRule.FILTER_INSTANCE, but all the 
deprecated rules seem to be null at runtime. I've checked with the debugger and 
can provide some screenshots (see attachment).
As I said, I use a bunch of deprecated rules in my application 
(FilterCorrelateRule.INSTANCE, SortJoinCopyRule.INSTANCE, 
FilterJoinRule.FILTER_ON_JOIN, SortProjectTransposeRule.INSTANCE, 
FilterMergeRule.INSTANCE, ...) and ALL of them are null at runtime. Looking 
closely, as [~zabetak] suggests, it seems a cyclic dependency initialization 
issue, since I can see in the debugger that the deprecated instances are null, 
even though the newer equivalents that they reference are not:
{code}
// INSTANCE is null
// CoreRules.FILTER_CORRELATE is not null
public static final FilterCorrelateRule INSTANCE = CoreRules.FILTER_CORRELATE;
{code}

I only face this problem on my application that uses Calcite as a library; 
executing Calcite build+tests in the same environment runs successfully.

> 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)

Reply via email to