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

Jesus Camacho Rodriguez commented on CALCITE-1769:
--------------------------------------------------

To give a bit more info.
_HiveRexExecutorImpl_ in Hive relies on the folding logic of the following 
class:
https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/optimizer/ConstantPropagateProcFactory.java
Further, Calcite also attempts some folding of CAST of constants, it should be 
here ([~julianhyde] can confirm):
https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/rex/RexSimplify.java
If I remember correctly, we are folding the expressions of the Filter before 
attempting translation to Druid query. Thus, maybe the logic in those classes 
do not cover this specific case.
It is worth looking at those two places to understand why we are not folding 
that specific constant.

> Push Filters down to druid when there a cast to numeric
> -------------------------------------------------------
>
>                 Key: CALCITE-1769
>                 URL: https://issues.apache.org/jira/browse/CALCITE-1769
>             Project: Calcite
>          Issue Type: Bug
>          Components: druid
>            Reporter: slim bouguerra
>            Assignee: Julian Hyde
>             Fix For: 1.13.0
>
>
> Currently if we have cast to numeric over literal filter will not get pushed.
> For instance query like {code}SELECT page from druid_table_1 WHERE page < 5 
> group by page {code} from hive will introduce a cast over `5`.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to