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

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

commit 164d78464d731c14a3f06db0635f138e2ad215a9
Author: Grant Henke <[email protected]>
AuthorDate: Fri Oct 9 10:26:01 2020 -0500

    [hms] Fix testSyncDisabled on Hive 4
    
    In Hive 4 the MetastoreDefaultTransformer ensures that
    external tables don’t use the warehouse as a their storage location.
    Kudu doesn’t actually use this location, but the location must still be
    valid.
    
    This patch changes the test to re-fetch the table after creation
    to get the location after translation has occured. It also deep
    copies the table before altering to ensure any unwanted properties
    are not copied over.
    
    Change-Id: I2dc12f350794314325736be581888cb69be917a1
    Reviewed-on: http://gerrit.cloudera.org:8080/16574
    Tested-by: Grant Henke <[email protected]>
    Reviewed-by: Andrew Wong <[email protected]>
---
 .../apache/kudu/hive/metastore/TestKuduMetastorePlugin.java  | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git 
a/java/kudu-hive/src/test/java/org/apache/kudu/hive/metastore/TestKuduMetastorePlugin.java
 
b/java/kudu-hive/src/test/java/org/apache/kudu/hive/metastore/TestKuduMetastorePlugin.java
index 4b6c4c9..a2b5b70 100644
--- 
a/java/kudu-hive/src/test/java/org/apache/kudu/hive/metastore/TestKuduMetastorePlugin.java
+++ 
b/java/kudu-hive/src/test/java/org/apache/kudu/hive/metastore/TestKuduMetastorePlugin.java
@@ -607,16 +607,14 @@ public class TestKuduMetastorePlugin {
     // A Kudu table should should be allowed to be created via Hive.
     Table table = newTable("table");
     client.createTable(table);
+    // Get the table from the HMS in case any translation occurred.
+    table = client.getTable(table.getDbName(), table.getTableName());
 
     // A Kudu table should should be allowed to be altered via Hive.
     // Add a column to the original table.
-    table.getSd().addToCols(new FieldSchema("b", "int", ""));
-    // Also change the location to avoid MetastoreDefaultTransformer validation
-    // that exists in some Hive versions.
-    table.getSd().setLocation(String.format("%s/%s/%s",
-        clientConf.get(HiveConf.ConfVars.METASTOREWAREHOUSE.varname),
-        table.getDbName(), table.getTableName()));
-    client.alter_table(table.getDbName(), table.getTableName(), table);
+    Table newTable = table.deepCopy();
+    newTable.getSd().addToCols(new FieldSchema("b", "int", ""));
+    client.alter_table(table.getDbName(), table.getTableName(), newTable);
 
     // A Kudu table should should be allowed to be dropped via Hive.
     client.dropTable(table.getDbName(), table.getTableName());

Reply via email to