diff --git standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java index 519e8fe..8a5de09 100644 --- standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java +++ standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java @@ -2810,6 +2810,9 @@ public Partition append_partition(final String dbName, final String tableName, public Partition append_partition_with_environment_context(final String dbName, final String tableName, final List part_vals, final EnvironmentContext envContext) throws InvalidObjectException, AlreadyExistsException, MetaException { + if (part_vals == null) { + throw new MetaException("The partition values must not be null."); + } startPartitionFunction("append_partition", dbName, tableName, part_vals); if (LOG.isDebugEnabled()) { for (String part : part_vals) { diff --git standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestAppendPartitions.java standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestAppendPartitions.java index b67f33d..79d0953 100644 --- standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestAppendPartitions.java +++ standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestAppendPartitions.java @@ -41,7 +41,6 @@ import org.apache.hadoop.hive.metastore.client.builder.PartitionBuilder; import org.apache.hadoop.hive.metastore.client.builder.TableBuilder; import org.apache.hadoop.hive.metastore.minihms.AbstractMetaStoreService; -import org.apache.thrift.transport.TTransportException; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -229,16 +228,11 @@ public void testAppendPartitionEmptyPartValues() throws Exception { 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) null); - Assert.fail("Exception should have been thrown."); - } catch (TTransportException | NullPointerException e) { - // TODO: NPE should not be thrown - } + Table table = tableWithPartitions; + client.appendPartition(table.getDbName(), table.getTableName(), (List) null); } @Test