You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by sz...@apache.org on 2020/04/17 08:52:17 UTC
[hive] branch master updated: HIVE-23213:
HiveStrictManagedMigration should handle legacy Kudu tables (Adam Szita,
reviewed by Peter Vary)
This is an automated email from the ASF dual-hosted git repository.
szita 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 e20c1c8 HIVE-23213: HiveStrictManagedMigration should handle legacy Kudu tables (Adam Szita, reviewed by Peter Vary)
e20c1c8 is described below
commit e20c1c82248341bc0c1881ecccfb0fece994064d
Author: Adam Szita <sz...@cloudera.com>
AuthorDate: Wed Apr 15 17:15:19 2020 +0200
HIVE-23213: HiveStrictManagedMigration should handle legacy Kudu tables (Adam Szita, reviewed by Peter Vary)
---
.../hive/ql/util/HiveStrictManagedMigration.java | 23 +++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
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 5e658a6..2c1ba5f 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
@@ -77,6 +77,7 @@ import com.google.common.collect.Lists;
import static java.util.stream.Collectors.toList;
import static org.apache.hadoop.hive.metastore.TableType.EXTERNAL_TABLE;
import static org.apache.hadoop.hive.metastore.TableType.MANAGED_TABLE;
+import static org.apache.hadoop.hive.metastore.api.hive_metastoreConstants.META_TABLE_STORAGE;
public class HiveStrictManagedMigration {
@@ -1004,6 +1005,8 @@ public class HiveStrictManagedMigration {
private static final Map<String, String> convertToExternalTableProps = new HashMap<>();
private static final Map<String, String> convertToAcidTableProps = new HashMap<>();
private static final Map<String, String> convertToMMTableProps = new HashMap<>();
+ private static final String KUDU_LEGACY_STORAGE_HANDLER = "com.cloudera.kudu.hive.KuduStorageHandler";
+ private static final String KUDU_STORAGE_HANDLER = "org.apache.hadoop.hive.kudu.KuduStorageHandler";
static {
convertToExternalTableProps.put("EXTERNAL", "TRUE");
@@ -1369,7 +1372,9 @@ public class HiveStrictManagedMigration {
alterPartitionInternal(table, modifiedPart);
}
- void updateTableProperties(Table table, Map<String, String> props) throws HiveException {
+ void updateTableProperties(Table table, Map<String, String> propsToApply) throws HiveException {
+ Map<String, String> props = new HashMap<>(propsToApply);
+ migrateKuduStorageHandlerType(table, props);
StringBuilder sb = new StringBuilder();
boolean isTxn = TxnUtils.isTransactionalTable(table);
org.apache.hadoop.hive.ql.metadata.Table modifiedTable = doFileRename ?
@@ -1637,6 +1642,22 @@ public class HiveStrictManagedMigration {
}
/**
+ * While upgrading from earlier versions we need to amend storage_handler value for Kudu tables that might
+ * have the legacy value set.
+ * @param table
+ * @param props
+ */
+ private static void migrateKuduStorageHandlerType(Table table, Map<String, String> props) {
+ Map<String, String> tableProperties = table.getParameters();
+ if (tableProperties != null) {
+ String storageHandler = tableProperties.get(META_TABLE_STORAGE);
+ if (KUDU_LEGACY_STORAGE_HANDLER.equals(storageHandler)) {
+ props.put(META_TABLE_STORAGE, KUDU_STORAGE_HANDLER);
+ }
+ }
+ }
+
+ /**
* can set it from tests to test when config needs something other than default values.
*/
@VisibleForTesting