Repository: hive
Updated Branches:
  refs/heads/branch-1 fb4622af8 -> d99f4dfdf


HIVE-12076 : WebHCat listing jobs after the given JobId even when 
templeton.jobs.listorder is set to lexicographicaldesc ( Kiran Kumar Kolli, 
reviewed by Hari Subramaniyan)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/d99f4dfd
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/d99f4dfd
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/d99f4dfd

Branch: refs/heads/branch-1
Commit: d99f4dfdf37323f725e364832d390979491043db
Parents: fb4622a
Author: Hari Subramaniyan <harisan...@apache.org>
Authored: Tue Oct 13 17:33:11 2015 -0700
Committer: Hari Subramaniyan <harisan...@apache.org>
Committed: Tue Oct 13 17:34:09 2015 -0700

----------------------------------------------------------------------
 .../main/java/org/apache/hive/hcatalog/templeton/Server.java  | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/d99f4dfd/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java
----------------------------------------------------------------------
diff --git 
a/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java
 
b/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java
index bba16c5..0c32792 100644
--- 
a/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java
+++ 
b/hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java
@@ -1003,9 +1003,11 @@ public class Server {
     }
 
     // Sort the list as requested
+    boolean isAscendingOrder = true;
     switch (appConf.getListJobsOrder()) {
     case lexicographicaldesc:
       Collections.sort(list, Collections.reverseOrder());
+      isAscendingOrder = false;
       break;
     case lexicographicalasc:
     default:
@@ -1021,9 +1023,12 @@ public class Server {
         if (currRecord >= numRecords) {
           break;
         }
+        else if (jobid == null || jobid.trim().length() == 0) {
+            currRecord++;
+        }
         // If the current record needs to be returned based on the
         // filter conditions specified by the user, increment the counter
-        else if ((jobid != null && job.compareTo(jobid) > 0) || jobid == null) 
{
+        else if (isAscendingOrder && job.compareTo(jobid) > 0 || 
!isAscendingOrder && job.compareTo(jobid) < 0) {
           currRecord++;
         }
         // The current record should not be included in the output detailList.

Reply via email to