[ https://issues.apache.org/jira/browse/HIVE-22666?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Krisztian Kasa updated HIVE-22666: ---------------------------------- Description: {code} EXPLAIN EXTENDED SELECT s_state, ranking FROM ( SELECT s_state AS s_state, rank() OVER (PARTITION BY s_state ORDER BY ss_net_profit) AS ranking FROM testtable_n1000) tmp1 WHERE ranking <= 3; {code} In this case the topN value (3) will be pushed to the ReduceSink operator https://github.com/apache/hive/blob/520aa19b20381bfd2ed25c835443c013f6e6ebb9/ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java#L257 ReduceSink operator uses PTFTopNHash to get the topN rows for each partition key (s_state) value. The goal of this jira is: - implement supporting partitioning in TopNKeyOperator - enable push down of partitioned TopNKeyOperator > Introduce TopNKey operator for PTF Reduce Sink > ---------------------------------------------- > > Key: HIVE-22666 > URL: https://issues.apache.org/jira/browse/HIVE-22666 > Project: Hive > Issue Type: Improvement > Reporter: Krisztian Kasa > Priority: Major > > {code} > EXPLAIN EXTENDED > SELECT s_state, ranking > FROM ( > SELECT s_state AS s_state, > rank() OVER (PARTITION BY s_state ORDER BY ss_net_profit) AS ranking > FROM testtable_n1000) tmp1 > WHERE ranking <= 3; > {code} > In this case the topN value (3) will be pushed to the ReduceSink operator > https://github.com/apache/hive/blob/520aa19b20381bfd2ed25c835443c013f6e6ebb9/ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java#L257 > ReduceSink operator uses PTFTopNHash to get the topN rows for each partition > key (s_state) value. > The goal of this jira is: > - implement supporting partitioning in TopNKeyOperator > - enable push down of partitioned TopNKeyOperator -- This message was sent by Atlassian Jira (v8.3.4#803005)