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

Phabricator commented on HIVE-3562:
-----------------------------------

njain has commented on the revision "HIVE-3562 [jira] Some limit can be pushed 
down to map stage".

  I thought about it, even with group bys, my question is still valid.
  I think, there is a bug.

  Do you think it would be simpler to allocate a heap with (upto) topN entries 
instead - throw
  the memory threshold out. If limit < threshold, use this optimization, 
otherwise just ignore this
  optimization.

INLINE COMMENTS
  ql/src/java/org/apache/hadoop/hive/ql/exec/ReduceSinkOperator.java:441 Isn't 
there a bug here ?

  You are using keyValues last entry to figure out whether it needs to be 
expanded or not.
  It may have an issue at the boundary - say entry 40th when a legit. entry is 
found.
  It might be simpler to pass the fact whether the entry was found or not.
  ql/src/java/org/apache/hadoop/hive/ql/exec/ReduceSinkOperator.java:468 This 
is not true if an entry is being inserted in between.
  I mean, if topN is 100, and we already have 100 entries.

  If we are inserting 50th entry, we should not be increasing usage

REVISION DETAIL
  https://reviews.facebook.net/D5967

To: JIRA, tarball, navis
Cc: njain

                
> Some limit can be pushed down to map stage
> ------------------------------------------
>
>                 Key: HIVE-3562
>                 URL: https://issues.apache.org/jira/browse/HIVE-3562
>             Project: Hive
>          Issue Type: Bug
>            Reporter: Navis
>            Assignee: Navis
>            Priority: Trivial
>         Attachments: HIVE-3562.D5967.1.patch, HIVE-3562.D5967.2.patch, 
> HIVE-3562.D5967.3.patch
>
>
> Queries with limit clause (with reasonable number), for example
> {noformat}
> select * from src order by key limit 10;
> {noformat}
> makes operator tree, 
> TS-SEL-RS-EXT-LIMIT-FS
> But LIMIT can be partially calculated in RS, reducing size of shuffling.
> TS-SEL-RS(TOP-N)-EXT-LIMIT-FS

--
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