Repository: hive
Updated Branches:
  refs/heads/master 7fa2ba8c7 -> d589ee755


HIVE-19119 Fix the TestAppendPartitions tests which are failing in the 
pre-commit runs (Marta Kuczora via Alan Gates)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/d589ee75
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/d589ee75
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/d589ee75

Branch: refs/heads/master
Commit: d589ee7550abb52864b71acb94e1efab601ea67e
Parents: 7fa2ba8
Author: Alan Gates <ga...@hortonworks.com>
Authored: Mon Apr 9 12:03:02 2018 -0700
Committer: Alan Gates <ga...@hortonworks.com>
Committed: Mon Apr 9 12:03:02 2018 -0700

----------------------------------------------------------------------
 .../apache/hadoop/hive/metastore/HiveMetaStore.java   |  2 +-
 .../hive/metastore/client/TestAppendPartitions.java   | 14 +++++---------
 2 files changed, 6 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/d589ee75/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --git 
a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
 
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index a2fe7d7..c81b8fa 100644
--- 
a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ 
b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -3094,7 +3094,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
         final String tableName, final List<String> part_vals, final 
EnvironmentContext envContext)
         throws InvalidObjectException, AlreadyExistsException, MetaException {
       if (part_vals == null || part_vals.isEmpty()) {
-        throw new MetaException("The partition values must not be null.");
+        throw new MetaException("The partition values must not be null or 
empty.");
       }
       String[] parsedDbName = parseDbName(dbName, conf);
       startPartitionFunction("append_partition", parsedDbName[CAT_NAME], 
parsedDbName[DB_NAME], tableName, part_vals);

http://git-wip-us.apache.org/repos/asf/hive/blob/d589ee75/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestAppendPartitions.java
----------------------------------------------------------------------
diff --git 
a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestAppendPartitions.java
 
b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestAppendPartitions.java
index 75b26f2..37ca40c 100644
--- 
a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestAppendPartitions.java
+++ 
b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestAppendPartitions.java
@@ -226,22 +226,18 @@ public class TestAppendPartitions extends 
MetaStoreClientTest {
     client.appendPartition(tableWithPartitions.getDbName(), null, 
partitionValues);
   }
 
-  @Test(expected = InvalidObjectException.class)
+  @Test(expected = MetaException.class)
   public void testAppendPartitionEmptyPartValues() throws Exception {
 
     Table table = tableWithPartitions;
     client.appendPartition(table.getDbName(), table.getTableName(), new 
ArrayList<>());
   }
 
-  @Test
+  @Test(expected = MetaException.class)
   public void testAppendPartitionNullPartValues() throws Exception {
-    try {
-      Table table = tableWithPartitions;
-      client.appendPartition(table.getDbName(), table.getTableName(), 
(List<String>) null);
-      Assert.fail("Exception should have been thrown.");
-    } catch (TTransportException | InvalidObjectException e) {
-      // TODO: NPE should not be thrown
-    }
+
+    Table table = tableWithPartitions;
+    client.appendPartition(table.getDbName(), table.getTableName(), 
(List<String>) null);
   }
 
   @Test

Reply via email to