This is an automated email from the ASF dual-hosted git repository.

ngangam pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git


The following commit(s) were added to refs/heads/master by this push:
     new 2a16520  HIVE-24603: Alter table not modifying the table 
location(Saihemanth via Naveen Gangam)
2a16520 is described below

commit 2a1652082fed215180a444acf6347b6d2648de86
Author: saihemanth <saihema...@cloudera.com>
AuthorDate: Thu Jan 7 14:42:39 2021 -0700

    HIVE-24603: Alter table not modifying the table location(Saihemanth via 
Naveen Gangam)
---
 .../main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java  | 4 ++--
 .../hive/metastore/client/TestTablesCreateDropAlterTruncate.java      | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git 
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
 
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
index cf4b85d..1cabcbe 100644
--- 
a/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
+++ 
b/standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
@@ -247,7 +247,7 @@ public class HiveAlterHandler implements AlterHandler {
           // in the table rename, its data location should not be changed. We 
can check
           // if the table directory was created directly under its database 
directory to tell
           // if it is such a table
-          String oldtRelativePath = wh.getDatabasePath(olddb).toUri()
+          String oldtRelativePath = wh.getDatabaseManagedPath(olddb).toUri()
               .relativize(srcPath.toUri()).toString();
           boolean tableInSpecifiedLoc = 
!oldtRelativePath.equalsIgnoreCase(name)
                   && !oldtRelativePath.equalsIgnoreCase(name + Path.SEPARATOR);
@@ -257,7 +257,7 @@ public class HiveAlterHandler implements AlterHandler {
             // get new location
             Database db = msdb.getDatabase(catName, newDbName);
             assert(isReplicated == 
HiveMetaStore.HMSHandler.isDbReplicationTarget(db));
-            Path databasePath = constructRenamedPath(wh.getDatabasePath(db), 
srcPath);
+            Path databasePath = 
constructRenamedPath(wh.getDatabaseManagedPath(db), srcPath);
             destPath = new Path(databasePath, newTblName);
             destFs = wh.getFs(destPath);
 
diff --git 
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestTablesCreateDropAlterTruncate.java
 
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestTablesCreateDropAlterTruncate.java
index f0c0017..41e8ee6 100644
--- 
a/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestTablesCreateDropAlterTruncate.java
+++ 
b/standalone-metastore/metastore-server/src/test/java/org/apache/hadoop/hive/metastore/client/TestTablesCreateDropAlterTruncate.java
@@ -802,7 +802,7 @@ public class TestTablesCreateDropAlterTruncate extends 
MetaStoreClientTest {
     Table alteredTable = client.getTable(newTable.getDbName(), 
newTable.getTableName());
     Assert.assertTrue("New table directory should exist",
         metaStore.isPathExists(new Path(alteredTable.getSd().getLocation())));
-    Assert.assertEquals("New directory should be set", new 
Path(metaStore.getExternalWarehouseRoot()
+    Assert.assertEquals("New directory should be set", new 
Path(metaStore.getWarehouseRoot()
         + "/" + alteredTable.getDbName() + ".db/" + 
alteredTable.getTableName()),
         new Path(alteredTable.getSd().getLocation()));
     Path dataFile = new Path(alteredTable.getSd().getLocation() + "/dataFile");

Reply via email to