diff --git metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java index 7e8f3fe..657eb56 100644 --- metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java +++ metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java @@ -727,7 +727,7 @@ public void compact(CompactionRequest rqst) throws MetaException { } public ShowCompactResponse showCompact(ShowCompactRequest rqst) throws MetaException { - ShowCompactResponse response = new ShowCompactResponse(); + ShowCompactResponse response = new ShowCompactResponse(new ArrayList()); Connection dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED); Statement stmt = null; try { diff --git metastore/src/test/org/apache/hadoop/hive/metastore/txn/TestCompactionTxnHandler.java metastore/src/test/org/apache/hadoop/hive/metastore/txn/TestCompactionTxnHandler.java index 5d6f066..69556c6 100644 --- metastore/src/test/org/apache/hadoop/hive/metastore/txn/TestCompactionTxnHandler.java +++ metastore/src/test/org/apache/hadoop/hive/metastore/txn/TestCompactionTxnHandler.java @@ -200,7 +200,7 @@ public void testMarkCleaned() throws Exception { assertEquals(0, txnHandler.findReadyToClean().size()); ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); - assertNull(rsp.getCompacts()); + assertEquals(0, rsp.getCompactsSize()); } @Test diff --git ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java index dce2573..99e16a5 100644 --- ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java +++ ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestCleaner.java @@ -68,7 +68,7 @@ public void cleanupAfterMajorTableCompaction() throws Exception { // Check there are no compactions requests left. ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); - Assert.assertNull(rsp.getCompacts()); + Assert.assertEquals(0, rsp.getCompactsSize()); // Check that the files are removed List paths = getDirectories(conf, t, null); @@ -101,7 +101,7 @@ public void cleanupAfterMajorPartitionCompaction() throws Exception { // Check there are no compactions requests left. ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); - Assert.assertNull(rsp.getCompacts()); + Assert.assertEquals(0, rsp.getCompactsSize()); // Check that the files are removed List paths = getDirectories(conf, t, p); @@ -132,7 +132,7 @@ public void cleanupAfterMinorTableCompaction() throws Exception { // Check there are no compactions requests left. ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); - Assert.assertNull(rsp.getCompacts()); + Assert.assertEquals(0, rsp.getCompactsSize()); // Check that the files are removed List paths = getDirectories(conf, t, null); @@ -172,7 +172,7 @@ public void cleanupAfterMinorPartitionCompaction() throws Exception { // Check there are no compactions requests left. ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); - Assert.assertNull(rsp.getCompacts()); + Assert.assertEquals(0, rsp.getCompactsSize()); // Check that the files are removed List paths = getDirectories(conf, t, p); @@ -289,7 +289,7 @@ public void cleanupAfterMajorPartitionCompactionNoBase() throws Exception { // Check there are no compactions requests left. ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); - Assert.assertNull(rsp.getCompacts()); + Assert.assertEquals(0, rsp.getCompactsSize()); // Check that the files are removed List paths = getDirectories(conf, t, p); diff --git ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java index 6b46822..c98439b 100644 --- ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java +++ ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestInitiator.java @@ -187,7 +187,7 @@ public void noCompactOnManyDifferentPartitionAborts() throws Exception { startInitiator(conf); ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); - Assert.assertNull(rsp.getCompacts()); + Assert.assertEquals(0, rsp.getCompactsSize()); } @Test @@ -246,7 +246,7 @@ public void noCompactWhenNoCompactSet() throws Exception { startInitiator(conf); ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); - Assert.assertNull(rsp.getCompacts()); + Assert.assertEquals(0, rsp.getCompactsSize()); } @Test @@ -379,7 +379,7 @@ public void noCompactTableDeltaPctNotHighEnough() throws Exception { startInitiator(conf); ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); - Assert.assertNull(rsp.getCompacts()); + Assert.assertEquals(0, rsp.getCompactsSize()); } @Test @@ -492,7 +492,7 @@ public void noCompactTableNotEnoughDeltas() throws Exception { startInitiator(conf); ShowCompactResponse rsp = txnHandler.showCompact(new ShowCompactRequest()); - Assert.assertNull(rsp.getCompacts()); + Assert.assertEquals(0, rsp.getCompactsSize()); } @Test