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 42c415884a..d73d85da41 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 @@ 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 @@ String tableRegex, String oldWarehouseRoot, TableMigrationOption migrationOption, + Properties confProps, boolean shouldModifyManagedTableLocation, boolean shouldModifyManagedTableOwner, boolean shouldModifyManagedTablePermissions, @@ -112,6 +114,7 @@ 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 RunOptions setShouldModifyManagedTableLocation(boolean shouldModifyManage this.tableRegex, this.oldWarehouseRoot, this.migrationOption, + this.confProps, shouldModifyManagedTableLocation, this.shouldModifyManagedTableOwner, this.shouldModifyManagedTablePermissions, @@ -141,6 +145,7 @@ public String toString() { ", tableRegex='" + tableRegex + '\'' + ", oldWarehouseRoot='" + oldWarehouseRoot + '\'' + ", migrationOption=" + migrationOption + + ", confProps=" + confProps + ", shouldModifyManagedTableLocation=" + shouldModifyManagedTableLocation + ", shouldModifyManagedTableOwner=" + shouldModifyManagedTableOwner + ", shouldModifyManagedTablePermissions=" + shouldModifyManagedTablePermissions + @@ -365,6 +370,7 @@ static RunOptions createRunOptions(CommandLine cli) throws Exception { tableRegex, oldWarehouseRoot, migrationOption, + confProps, shouldModifyManagedTableLocation, shouldModifyManagedTableOwner, shouldModifyManagedTablePermissions, @@ -415,6 +421,15 @@ private static int getIntOptionValue(CommandLine commandLine, String optionName, 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);