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

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

It seems to me initial implementation should support at least:
- Push through Project if expression(s) in TopNKey can be mapped to 
expression(s) based on Project input.
- Push through GroupBy. No grouping sets. If TopNKey expression is same as 
GroupBy expression, we can push it and remove it from above GroupBy. If 
expression in TopNKey shared common prefix with GroupBy, TopNKey could be 
pushed through GroupBy using that prefix and kept above it.
- Push through ReduceSink. If TopNKey expression is same as ReduceSink 
expression and order is the same, we can push it and remove it from above 
ReduceSink. If expression in TopNKey shared common prefix with ReduceSink 
including same order, TopNKey could be pushed through ReduceSink using that 
prefix and kept above it.
- Push through FOJ. Push TopNKey expression without keys to largest input. Keep 
on top of FOJ. 
- Push through LOJ. If TopNKey expression refers fully to expressions from left 
input, push with rewriting of expressions and remove from top of LOJ. If 
TopNKey expression has a prefix that refers to expressions from left input, 
push with rewriting of those expressions and keep on top of LOJ.
- Push through ROJ. Same as for LOJ, but change left to right.
[~gopalv], thoughts? Does it seem correct? Should we consider any other for the 
minimum implementation?


> Introduce rule to pushdown TopNKey through plan
> -----------------------------------------------
>
>                 Key: HIVE-20148
>                 URL: https://issues.apache.org/jira/browse/HIVE-20148
>             Project: Hive
>          Issue Type: Improvement
>          Components: Physical Optimizer
>    Affects Versions: 4.0.0
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Teddy Choi
>            Priority: Major
>
> Follow-up for HIVE-17896, which introduces TopNKey operator.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to