hadoop-hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zheng Shao (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HIVE-61) Implment ORDER BY
Date Tue, 21 Apr 2009 00:27:47 GMT

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

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

Nit: Can you move the definition of numReducers inside the "if (qbp.getClusterByForClause(dest)
!= null ... "? In case the "if" is not executed, the variables don't get used, so they should
not be exposed outside the "if"s.

There are 2 places that you assign values to extraMRStep - I think it's cleaner to split them
into 2 different variables, each defined and assigned in the "then" and "else" clause of "if
(qbp.getIsSubQ())". That makes the logic cleaner. What do you think?


{code}
@@ -2944,21 +2958,36 @@
       curr = genSelectPlan(dest, qb, curr);
       Integer limit = qbp.getDestLimit(dest);
 
+      boolean extraMRStep = true;
+      int numReducers = -1;
+      if (qbp.getOrderByForClause(dest) != null) {
+        numReducers = 1;
+        extraMRStep = false;
+      }
+
       if (qbp.getClusterByForClause(dest) != null
           || qbp.getDistributeByForClause(dest) != null
+          || qbp.getOrderByForClause(dest) != null
           || qbp.getSortByForClause(dest) != null) {
-        curr = genReduceSinkPlan(dest, qb, curr, -1);
+        curr = genReduceSinkPlan(dest, qb, curr, numReducers);
       }
 
       if (qbp.getIsSubQ()) {
         if (limit != null) {
-          curr = genLimitMapRedPlan(dest, qb, curr, limit.intValue(), false);
+          curr = genLimitMapRedPlan(dest, qb, curr, limit.intValue(), extraMRStep);
         }
       } else {
         curr = genConversionOps(dest, qb, curr);
         // exact limit can be taken care of by the fetch operator
         if (limit != null) {
-          curr = genLimitMapRedPlan(dest, qb, curr, limit.intValue(), qb.getIsQuery());
+          if (qb.getIsQuery() &&
+              qbp.getClusterByForClause(dest) == null &&
+              qbp.getSortByForClause(dest) == null)
+            extraMRStep = false;
+          else
+            extraMRStep = true;
+
+          curr = genLimitMapRedPlan(dest, qb, curr, limit.intValue(), extraMRStep);
           qb.getParseInfo().setOuterQueryLimit(limit.intValue());
         }
         curr = genFileSinkPlan(dest, qb, curr);
{code}


> 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
>         Attachments: hive.61.1.patch
>
>
> 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.


Mime
View raw message