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

Julian Hyde commented on CALCITE-5448:
--------------------------------------

The simplest thing would be to make sure that your planner has an executor.

[~rubenql] may be right - I have not had time to grok his argument and agree or 
refute - but the status quo is that executors are passed via the planner, and 
while a simplifier may have one internally, that is not the way that executors 
are intended to be passed.

>  ReduceExpressionsRule does not always constant fold expressions
> ----------------------------------------------------------------
>
>                 Key: CALCITE-5448
>                 URL: https://issues.apache.org/jira/browse/CALCITE-5448
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.32.0
>            Reporter: Mihai Budiu
>            Priority: Minor
>
> I have manually built a HepPlanner to optimize the SQL queries, and I 
> discovered that the rule ReduceExpressionsRule does not really do anything in 
> my setup.
> I am looking at method ReduceExpressionsRule.reduceExpressionsInternal.
> There is this piece of code:
> {code}
>     RexExecutor executor = rel.getCluster().getPlanner().getExecutor();
>     if (executor == null) {
>       // Cannot reduce expressions: caller has not set an executor in their
>       // environment. Caller should execute something like the following 
> before
>       // invoking the planner:
>       //
>       // final RexExecutorImpl executor =
>       //   new RexExecutorImpl(Schemas.createDataContext(null));
>       // rootRel.getCluster().getPlanner().setExecutor(executor);
>       return changed;
>     }
> {code}
>  
> However, the caller of this function, the method reduceExpressions, has 
> carefully inserted an executor in the RexSimplify class in case the cluster 
> has no executor. Shouldn't that executor be used instead of trying the 
> missing one? (It is currently private in the RexSimplify class.)
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to