diff --git itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestQueryDisplay.java itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestQueryDisplay.java index cc18ce7..6c60125 100644 --- itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestQueryDisplay.java +++ itests/hive-unit/src/test/java/org/apache/hive/service/cli/session/TestQueryDisplay.java @@ -90,8 +90,8 @@ public void testQueryDisplay() throws Exception { historicSqlOperations = sessionManager.getOperationManager().getHistoricalSQLOperations(); Assert.assertEquals(liveSqlOperations.size(), 0); Assert.assertEquals(historicSqlOperations.size(), 2); - verifyDDL(historicSqlOperations.get(0),"show databases", opHandle1.getHandleIdentifier().toString(), true); - verifyDDL(historicSqlOperations.get(1),"show tables", opHandle2.getHandleIdentifier().toString(), true); + verifyDDL(historicSqlOperations.get(1),"show databases", opHandle1.getHandleIdentifier().toString(), true); + verifyDDL(historicSqlOperations.get(0),"show tables", opHandle2.getHandleIdentifier().toString(), true); session.close(); } diff --git service/src/java/org/apache/hive/service/cli/operation/OperationManager.java service/src/java/org/apache/hive/service/cli/operation/OperationManager.java index 2f18231..8388e6a 100644 --- service/src/java/org/apache/hive/service/cli/operation/OperationManager.java +++ service/src/java/org/apache/hive/service/cli/operation/OperationManager.java @@ -371,13 +371,14 @@ public OperationLog getOperationLogByThread() { /** * @return displays representing a number of historical SQLOperations, at max number of - * hive.server2.webui.max.historic.queries + * hive.server2.webui.max.historic.queries. Newest items will be first. */ public List getHistoricalSQLOperations() { List result = new LinkedList<>(); synchronized (webuiLock) { if (historicSqlOperations != null) { result.addAll(historicSqlOperations.values()); + Collections.reverse(result); } } return result;