You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by jd...@apache.org on 2019/07/24 18:04:18 UTC

[hive] branch master updated: HIVE-22035: HiveStrictManagedMigration settings do not always get set with --hiveconf arguments (Jason Dere, reviewed by Ashutosh Chauhan)

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

jdere 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 bab107d  HIVE-22035: HiveStrictManagedMigration settings do not always get set with --hiveconf arguments (Jason Dere, reviewed by Ashutosh Chauhan)
bab107d is described below

commit bab107d560c2369f635a45eaaefff6078c476f55
Author: Jason Dere <jd...@cloudera.com>
AuthorDate: Wed Jul 24 11:03:47 2019 -0700

    HIVE-22035: HiveStrictManagedMigration settings do not always get set with --hiveconf arguments (Jason Dere, reviewed by Ashutosh Chauhan)
---
 .../hadoop/hive/ql/util/HiveStrictManagedMigration.java   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/ql/src/java/org/apache/hadoop/hive/ql/util/HiveStrictManagedMigration.java b/ql/src/java/org/apache/hadoop/hive/ql/util/HiveStrictManagedMigration.java
index 9d23c13..19fb750 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/util/HiveStrictManagedMigration.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/util/HiveStrictManagedMigration.java
@@ -90,6 +90,7 @@ public class HiveStrictManagedMigration {
     final String tableRegex;
     final String oldWarehouseRoot;
     final TableMigrationOption migrationOption;
+    final Properties confProps;
     final boolean shouldModifyManagedTableLocation;
     final boolean shouldModifyManagedTableOwner;
     final boolean shouldModifyManagedTablePermissions;
@@ -101,6 +102,7 @@ public class HiveStrictManagedMigration {
                String tableRegex,
                String oldWarehouseRoot,
                TableMigrationOption migrationOption,
+               Properties confProps,
                boolean shouldModifyManagedTableLocation,
                boolean shouldModifyManagedTableOwner,
                boolean shouldModifyManagedTablePermissions,
@@ -112,6 +114,7 @@ public class HiveStrictManagedMigration {
       this.tableRegex = tableRegex;
       this.oldWarehouseRoot = oldWarehouseRoot;
       this.migrationOption = migrationOption;
+      this.confProps = confProps;
       this.shouldModifyManagedTableLocation = shouldModifyManagedTableLocation;
       this.shouldModifyManagedTableOwner = shouldModifyManagedTableOwner;
       this.shouldModifyManagedTablePermissions = shouldModifyManagedTablePermissions;
@@ -126,6 +129,7 @@ public class HiveStrictManagedMigration {
               this.tableRegex,
               this.oldWarehouseRoot,
               this.migrationOption,
+              this.confProps,
               shouldModifyManagedTableLocation,
               this.shouldModifyManagedTableOwner,
               this.shouldModifyManagedTablePermissions,
@@ -141,6 +145,7 @@ public class HiveStrictManagedMigration {
               ", tableRegex='" + tableRegex + '\'' +
               ", oldWarehouseRoot='" + oldWarehouseRoot + '\'' +
               ", migrationOption=" + migrationOption +
+              ", confProps=" + confProps +
               ", shouldModifyManagedTableLocation=" + shouldModifyManagedTableLocation +
               ", shouldModifyManagedTableOwner=" + shouldModifyManagedTableOwner +
               ", shouldModifyManagedTablePermissions=" + shouldModifyManagedTablePermissions +
@@ -365,6 +370,7 @@ public class HiveStrictManagedMigration {
         tableRegex,
         oldWarehouseRoot,
         migrationOption,
+        confProps,
         shouldModifyManagedTableLocation,
         shouldModifyManagedTableOwner,
         shouldModifyManagedTablePermissions,
@@ -415,6 +421,15 @@ public class HiveStrictManagedMigration {
     this.curWhRootPath = warehouseRootCheckResult.curWhRootPath;
     this.encryptionShim = warehouseRootCheckResult.encryptionShim;
 
+    // Make sure all --hiveconf settings get added to the HiveConf.
+    // This allows utility-specific settings (such as strict.managed.tables.migration.owner)
+    // to be set via command line.
+    if (runOptions.confProps != null) {
+      for (String propKey : runOptions.confProps.stringPropertyNames()) {
+        this.conf.set(propKey, runOptions.confProps.getProperty(propKey));
+      }
+    }
+
     this.hms = new CloseableThreadLocal<>(() -> {
       try {
         HiveMetaStoreClient hiveMetaStoreClient = new HiveMetaStoreClient(conf);