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

Ashutosh Chauhan commented on HIVE-4180:
----------------------------------------

Easier to explain via an example. Consider following query:
{noformat}
select s_store_name,
       i_product_name,
       rnk
from (
    select ss_store_sk,
           ss_item_sk,
           rank() over (partition by ss_store_sk order by item_total desc) as 
rnk
      from (
        select ss_store_sk,
               ss_item_sk,
               sum(ss_sales_price) as item_total
          from store_sales
          join date_dim on (store_sales.ss_sold_date_sk = date_dim.d_date_sk)
          where date_dim.d_year = 2000
            and date_dim.d_moy = 12
            and date_dim.d_dom = 24
          group by ss_store_sk,
                   ss_item_sk
     ) item_sales
) item_rank
join item on (item.i_item_sk = item_rank.ss_item_sk)
join store on (item_rank.ss_store_sk = store.s_store_sk)
where rnk <= 3;
{noformat}

Running explain before and after latest patch will prove this point. With the 
previous patch, filter (rnk <= 3) will not be moved and will be applied last 
after the outermost joins, whereas what we really want is this filter to get 
pushed up till PTFOperator and applied right after it. Latest patch gets us 
that plan.
                
> Filter getting dropped with PTFOperator
> ---------------------------------------
>
>                 Key: HIVE-4180
>                 URL: https://issues.apache.org/jira/browse/HIVE-4180
>             Project: Hive
>          Issue Type: Bug
>          Components: PTF-Windowing
>            Reporter: Ashutosh Chauhan
>            Assignee: Ashutosh Chauhan
>
> Another case where filter push down was not handled correctly.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to