[ 
https://issues.apache.org/jira/browse/HIVE-24373?focusedWorklogId=511312&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-511312
 ]

ASF GitHub Bot logged work on HIVE-24373:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Nov/20 11:22
            Start Date: 13/Nov/20 11:22
    Worklog Time Spent: 10m 
      Work Description: maheshk114 merged pull request #1666:
URL: https://github.com/apache/hive/pull/1666


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 511312)
    Time Spent: 20m  (was: 10m)

> Wrong predicate is pushed down for view with constant value projection.
> -----------------------------------------------------------------------
>
>                 Key: HIVE-24373
>                 URL: https://issues.apache.org/jira/browse/HIVE-24373
>             Project: Hive
>          Issue Type: Bug
>            Reporter: mahesh kumar behera
>            Assignee: mahesh kumar behera
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: HIVE-24373-explain-paln.txt, HIVE-24373.patch
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> For below query the predicate pushed down for one of the table scan is not 
> proper.
>  
> {code:java}
> set hive.explain.user=false;
> set hive.cbo.enable=false;
> set hive.optimize.ppd=true;DROP TABLE arc;
> CREATE table arc(`dt_from` string, `dt_to` string);
> CREATE table loc1(`dt_from` string, `dt_to` string);
> CREATE
>  VIEW view AS
>      SELECT
>         '9999' as DT_FROM,
>         uuid() as DT_TO
>      FROM
>        loc1
>  UNION ALL
>      SELECT
>         dt_from as DT_FROM,
>         uuid() as DT_TO
>      FROM
>        arc;
> EXPLAIN
>     SELECT
>       dt_from, dt_to
>     FROM
>       view
>     WHERE
>       '2020'  between dt_from and dt_to;
> {code}
>  
> For table loc1,  DT_FROM is projected as '9999' so the predicate "predicate: 
> '2020' BETWEEN '9999' AND _col1 (type: boolean)" is proper. But for table 
> arc, the column is projected so the predicate should be "predicate: '2020' 
> BETWEEN _col0 (type: boolean) AND _col1 (type: boolean)".
> This is because the predicates are stored in a map for each expression. Here 
> the expression is "_col0". When the predicate is pushed down the union, the 
> same predicate is used for creating the filter expression. Later when 
> constant replacement is done, the first filter is overwriting the second one.
> So we should create a clone (as done at other places) before using the cached 
> predicate for filter. This way the overwrite can be avoided.   
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to