[
https://issues.apache.org/jira/browse/CALCITE-566?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julian Hyde updated CALCITE-566:
--------------------------------
Fix Version/s: (was: 1.1.0-incubating)
next
> ReduceExpressionsRule requires planner to have an Executor
> ----------------------------------------------------------
>
> Key: CALCITE-566
> URL: https://issues.apache.org/jira/browse/CALCITE-566
> Project: Calcite
> Issue Type: Bug
> Reporter: Julian Hyde
> Assignee: Julian Hyde
> Fix For: next
>
>
> ReduceExpressionsRule requires planner to have an Executor. If it does not,
> you get a stack trace like this:
> {code}java.lang.NullPointerException
> at
> org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressions(ReduceExpressionsRule.java:387)
> at
> org.apache.calcite.rel.rules.ReduceExpressionsRule$3.onMatch(ReduceExpressionsRule.java:223)
> at
> org.apache.calcite.plan.AbstractRelOptPlanner.fireRule(AbstractRelOptPlanner.java:326)
> at org.apache.calcite.plan.hep.HepPlanner.applyRule(HepPlanner.java:515)
> at
> org.apache.calcite.plan.hep.HepPlanner.applyRules(HepPlanner.java:393)
> at
> org.apache.calcite.plan.hep.HepPlanner.executeInstruction(HepPlanner.java:285)
> at
> org.apache.calcite.plan.hep.HepInstruction$RuleCollection.execute(HepInstruction.java:72)
> at
> org.apache.calcite.plan.hep.HepPlanner.executeProgram(HepPlanner.java:207)
> at
> org.apache.calcite.plan.hep.HepPlanner.findBestExp(HepPlanner.java:194)
> at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.hepPlan(CalcitePlanner.java:837)
> at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.applyPreJoinOrderingTransforms(CalcitePlanner.java:770)
> at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:701)
> at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner$CalcitePlannerAction.apply(CalcitePlanner.java:658)
> at org.apache.calcite.tools.Frameworks$1.apply(Frameworks.java:109)
> at
> org.apache.calcite.prepare.CalcitePrepareImpl.perform(CalcitePrepareImpl.java:715)
> at org.apache.calcite.tools.Frameworks.withPrepare(Frameworks.java:145)
> at org.apache.calcite.tools.Frameworks.withPlanner(Frameworks.java:105)
> at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner.getOptimizedAST(CalcitePlanner.java:568)
> at
> org.apache.hadoop.hive.ql.parse.CalcitePlanner.genOPTree(CalcitePlanner.java:224){code}
> There is a workaround. Set the executor of the planner before invoking
> {{findBestExp}}. Set it on the planner of the cluster of the root RelNode
> (which is not necessarily the planner that is executing the rules):
> {code}final RexExecutorImpl executor =
> new RexExecutorImpl(Schemas.createDataContext(null));
> rootRel.getCluster().getPlanner().setExecutor(executor);{code}
> We should fix this by having the rule give a warning and return (doing
> nothing) if an executor is not set.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)