Repository: hive Updated Branches: refs/heads/master 6818777dc -> 7efb7308c
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/7efb7308 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/7efb7308 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/7efb7308 Branch: refs/heads/master Commit: 7efb7308c558cab7f08414d9d5e0c6791a29c529 Parents: 6818777 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:33:11 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/7efb7308/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.