[ 
https://issues.apache.org/jira/browse/CALCITE-5448?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ruben Q L updated CALCITE-5448:
-------------------------------
    Description: 
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.)

 

  was:
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:

    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;
    }

 

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

 


>  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