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 062d5a0..889aa78 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 @@ -105,6 +105,7 @@ 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 MR_AM_MEMORY_MB = "templeton.mr.am.memory.mb"; + public static final String TEMPLETON_JOBSLIST_ORDER = "templeton.jobs.listorder"; /** * see webhcat-default.xml @@ -280,6 +281,16 @@ public int compare(Map.Entry ent, Map.Entry ent2 } } } + + public boolean listJobsInReverseOrder() { + String requestedOrder = get(TEMPLETON_JOBSLIST_ORDER); + if (requestedOrder != null && requestedOrder.trim().equalsIgnoreCase("reverse")) + { + return true; + } + + return false; + } public void startCleanup() { JobState.getStorageInstance(this).startCleanup(this); 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 27b8e38..a3184f6 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 @@ -1004,6 +1004,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.