diff --git hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/AppConfig.java hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/AppConfig.java index 77952be..7871866 100644 --- hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/AppConfig.java +++ hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/AppConfig.java @@ -102,6 +102,8 @@ public static final String HIVE_ARCHIVE_NAME = "templeton.hive.archive"; public static final String HIVE_PATH_NAME = "templeton.hive.path"; public static final String MAPPER_MEMORY_MB = "templeton.mapper.memory.mb"; + public static final String TEMPLETON_JOBSLIST_ORDER = "templeton.jobs.listorder"; + /** * see webhcat-default.xml */ @@ -252,6 +254,16 @@ public int compare(Map.Entry ent, Map.Entry ent2 public void startCleanup() { JobState.getStorageInstance(this).startCleanup(this); } + + public boolean listJobsInReverseOrder() { + String requestedOrder = get(TEMPLETON_JOBSLIST_ORDER); + if (requestedOrder != null && requestedOrder.trim().equalsIgnoreCase("reverse")) + { + return true; + } + + return false; + } public String getHadoopConfDir() { return get(HADOOP_CONF_DIR); diff --git hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java index a28e04d..083a4ad 100644 --- hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java +++ hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/Server.java @@ -988,6 +988,11 @@ public QueueStatusBean deleteJobId(@PathParam("jobid") String jobid) // Sort the list lexicographically Collections.sort(list); + if (appConf.listJobsInReverseOrder()) + { + // Reverse order as requested + Collections.reverse(list); + } for (String job : list) { // If numRecords = -1, fetch all records.