You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hive.apache.org by "Zheng Shao (JIRA)" <ji...@apache.org> on 2009/03/26 22:39:50 UTC

[jira] Commented: (HIVE-61) Implment ORDER BY

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

Zheng Shao commented on HIVE-61:
--------------------------------

Most of the use cases with total ordering is to get the top 10.

For getting the top 10, the current work-around is:

First store the top 10 from each partition to some temp table:
INSERT OVERWRITE tableB
REDUCE a.*
USING 'head -n 10'
AS (col1, col2, col3, col4, ...)
FROM (SELECT * FROM tableA SORT BY col3 DESC, col4 ASC) a

Second, set the #reducer to 1 and get the top 10 globally.
set mapred.reduce.tasks=1;
SELECT * FROM tableB SORT BY col3 DESC, col4 ASC LIMIT 10


> Implment ORDER BY
> -----------------
>
>                 Key: HIVE-61
>                 URL: https://issues.apache.org/jira/browse/HIVE-61
>             Project: Hadoop Hive
>          Issue Type: New Feature
>          Components: Query Processor
>            Reporter: Jeff Hammerbacher
>            Assignee: Zheng Shao
>
> ORDER BY is in the query language reference but currently is a no-op. We should make it an op.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.