You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pv...@apache.org on 2018/03/06 15:56:42 UTC
hive git commit: HIVE-18697: The HiveMetastore.exchange_partitions
method throws FileNotFoundException if the given partition doesn't exist in
the source table (Marta Kuczora, via Peter Vary)
Repository: hive
Updated Branches:
refs/heads/master 7cb31c030 -> 6001f51f4
HIVE-18697: The HiveMetastore.exchange_partitions method throws FileNotFoundException if the given partition doesn't exist in the source table (Marta Kuczora, via Peter Vary)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/6001f51f
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/6001f51f
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/6001f51f
Branch: refs/heads/master
Commit: 6001f51f48bf3f2fa3b01d3ade55d02b8fc4857a
Parents: 7cb31c0
Author: Peter Vary <pv...@cloudera.com>
Authored: Tue Mar 6 16:55:53 2018 +0100
Committer: Peter Vary <pv...@cloudera.com>
Committed: Tue Mar 6 16:55:53 2018 +0100
----------------------------------------------------------------------
.../java/org/apache/hadoop/hive/metastore/HiveMetaStore.java | 4 ++++
.../hadoop/hive/metastore/client/TestExchangePartitions.java | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/6001f51f/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 1c422ca..2be018b 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
@@ -3410,6 +3410,10 @@ public class HiveMetaStore extends ThriftHiveMetastore {
}
List<Partition> partitionsToExchange = get_partitions_ps(sourceDbName, sourceTableName,
partVals, (short)-1);
+ if (partitionsToExchange == null || partitionsToExchange.isEmpty()) {
+ throw new MetaException("No partition is found with the values " + partitionSpecs
+ + " for the table " + sourceTableName);
+ }
boolean sameColumns = MetaStoreUtils.compareFieldColumns(
sourceTable.getSd().getCols(), destinationTable.getSd().getCols());
boolean samePartitions = MetaStoreUtils.compareFieldColumns(
http://git-wip-us.apache.org/repos/asf/hive/blob/6001f51f/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestExchangePartitions.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestExchangePartitions.java b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestExchangePartitions.java
index 3bd1f8d..5b21491 100644
--- a/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestExchangePartitions.java
+++ b/standalone-metastore/src/test/java/org/apache/hadoop/hive/metastore/client/TestExchangePartitions.java
@@ -691,8 +691,6 @@ public class TestExchangePartitions extends MetaStoreClientTest {
@Test(expected = MetaException.class)
public void testExchangePartitionsNoPartExists() throws Exception {
- // TODO: FileNotFoundException will occur. This use case could be handled in a better way like
- // checking if the partitionsToExchange is empty and throw an exception if it is.
Map<String, String> partitionSpecs =
getPartitionSpec(Lists.newArrayList("2017", "march", "25"));
client.exchange_partitions(partitionSpecs, sourceTable.getDbName(),
@@ -1284,8 +1282,6 @@ public class TestExchangePartitions extends MetaStoreClientTest {
@Test(expected = MetaException.class)
public void testExchangePartitionNoPartExists() throws Exception {
- // TODO: FileNotFoundException will occur. This use case could be handled in a better way like
- // checking if the partitionsToExchange is empty and throw an exception if it is.
Map<String, String> partitionSpecs =
getPartitionSpec(Lists.newArrayList("2017", "march", "25"));
client.exchange_partition(partitionSpecs, sourceTable.getDbName(),