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

Jesus Camacho Rodriguez commented on HIVE-13068:
------------------------------------------------

SimpleConstantReduction will only get exercised if CBO has optimized the plan. 

For instance, while return path is not on, we might need to use CAST on top of 
a constant when we go back through the AST e.g. UDFToDouble(100), and we do not 
want to miss that opportunity to fold. Further, we do not fold some expressions 
in Calcite yet e.g. power function, which was causing some test regressions. 
Concretely, SimpleConstantReduction will only fold a deterministic function 
expression with constant parameters; otherwise, it does not even try. Thus, the 
overhead should be low.

In addition, if condition for a given e.g. semijoin is just the {{true}} 
constant, a filter with condition {{true}} is introduced on its left input by 
SemanticAnalyzer. I tried to fix this in SemanticAnalyzer, but the logic to 
infer the join conditions should change, and it is not straightforward. Thus, I 
took advantage of the fact that we are checking the Filter operators in 
SimpleConstantReduction, and we remove the filter if the condition is {{true}}.

> Disable Hive ConstantPropagate optimizer when CBO has optimized the plan II
> ---------------------------------------------------------------------------
>
>                 Key: HIVE-13068
>                 URL: https://issues.apache.org/jira/browse/HIVE-13068
>             Project: Hive
>          Issue Type: Sub-task
>          Components: CBO, Logical Optimizer
>    Affects Versions: 2.1.0
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Jesus Camacho Rodriguez
>         Attachments: HIVE-13068.01.patch, HIVE-13068.01.patch, 
> HIVE-13068.patch
>
>
> After HIVE-12543 went in, we need follow-up work to disable the last call to 
> ConstantPropagate in Hive. This probably implies work on extending the 
> constant folding logic in Calcite.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to