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 8539fea..0d47bec 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 @@ -3083,7 +3083,7 @@ 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 || 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); 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 75b26f2..37ca40c 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 @@ -226,22 +226,18 @@ public void testAppendPartitionNullTable() throws Exception { 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) 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) null); } @Test