You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2017/07/26 23:37:45 UTC
hive git commit: HIVE-16710 : Make MAX_MS_TYPENAME_LENGTH
configurable (Zhiyuan Yang, reviewed by Sergey Shelukhin)
Repository: hive
Updated Branches:
refs/heads/branch-1 07522ad5b -> d4bbcfd82
HIVE-16710 : Make MAX_MS_TYPENAME_LENGTH configurable (Zhiyuan Yang, reviewed by Sergey Shelukhin)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/d4bbcfd8
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/d4bbcfd8
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/d4bbcfd8
Branch: refs/heads/branch-1
Commit: d4bbcfd823e09c668d683cabfd0208f525061fb2
Parents: 07522ad
Author: sergey <se...@apache.org>
Authored: Wed Jul 26 16:34:41 2017 -0700
Committer: sergey <se...@apache.org>
Committed: Wed Jul 26 16:34:41 2017 -0700
----------------------------------------------------------------------
.../java/org/apache/hadoop/hive/conf/HiveConf.java | 4 ++++
.../hadoop/hive/metastore/HiveAlterHandler.java | 2 +-
.../apache/hadoop/hive/metastore/HiveMetaStore.java | 4 ++--
.../apache/hadoop/hive/metastore/MetaStoreUtils.java | 14 +++++++-------
4 files changed, 14 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/d4bbcfd8/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 10b0644..e0c8e82 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -458,6 +458,10 @@ public class HiveConf extends Configuration {
METASTORE_USE_THRIFT_COMPACT_PROTOCOL("hive.metastore.thrift.compact.protocol.enabled", false,
"If true, the metastore Thrift interface will use TCompactProtocol. When false (default) TBinaryProtocol will be used.\n" +
"Setting it to true will break compatibility with older clients running TBinaryProtocol."),
+ METASTORE_MAX_TYPENAME_LENGTH("hive.metastore.max.typename.length", 2000,
+ "Max length allowed in metastore type name, as number of unicode characters. Setting it " +
+ "to a value higher than the backend DB supports will result either in DB errors or the " +
+ "values being silently truncated"),
METASTORE_CLUSTER_DELEGATION_TOKEN_STORE_CLS("hive.cluster.delegation.token.store.class",
"org.apache.hadoop.hive.thrift.MemoryTokenStore",
"The delegation token store implementation. Set to org.apache.hadoop.hive.thrift.ZooKeeperTokenStore for load-balanced cluster."),
http://git-wip-us.apache.org/repos/asf/hive/blob/d4bbcfd8/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
index a32f03d..fa86c42 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
@@ -83,7 +83,7 @@ public class HiveAlterHandler implements AlterHandler {
throw new InvalidOperationException(newt.getTableName()
+ " is not a valid object name");
}
- String validate = MetaStoreUtils.validateTblColumns(newt.getSd().getCols());
+ String validate = MetaStoreUtils.validateTblColumns(newt.getSd().getCols(), hiveConf);
if (validate != null) {
throw new InvalidOperationException("Invalid column " + validate);
}
http://git-wip-us.apache.org/repos/asf/hive/blob/d4bbcfd8/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index 7baa0e6..ad26c43 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -1342,12 +1342,12 @@ public class HiveMetaStore extends ThriftHiveMetastore {
throw new InvalidObjectException(tbl.getTableName()
+ " is not a valid object name");
}
- String validate = MetaStoreUtils.validateTblColumns(tbl.getSd().getCols());
+ String validate = MetaStoreUtils.validateTblColumns(tbl.getSd().getCols(), hiveConf);
if (validate != null) {
throw new InvalidObjectException("Invalid column " + validate);
}
if (tbl.getPartitionKeys() != null) {
- validate = MetaStoreUtils.validateTblColumns(tbl.getPartitionKeys());
+ validate = MetaStoreUtils.validateTblColumns(tbl.getPartitionKeys(), hiveConf);
if (validate != null) {
throw new InvalidObjectException("Invalid partition column " + validate);
}
http://git-wip-us.apache.org/repos/asf/hive/blob/d4bbcfd8/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
index 7878f16..ab6b738 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
@@ -550,12 +550,12 @@ public class MetaStoreUtils {
return true;
}
- static public String validateTblColumns(List<FieldSchema> cols) {
+ static public String validateTblColumns(List<FieldSchema> cols, Configuration conf) {
for (FieldSchema fieldSchema : cols) {
if (!validateColumnName(fieldSchema.getName())) {
return "name: " + fieldSchema.getName();
}
- String typeError = validateColumnType(fieldSchema.getType());
+ String typeError = validateColumnType(fieldSchema.getType(), conf);
if (typeError != null) {
return typeError;
}
@@ -632,8 +632,6 @@ public class MetaStoreUtils {
return false;
}
- public static final int MAX_MS_TYPENAME_LENGTH = 2000; // 4000/2, for an unlikely unicode case
-
public static final String TYPE_FROM_DESERIALIZER = "<derived from deserializer>";
/**
* validate column type
@@ -642,10 +640,12 @@ public class MetaStoreUtils {
* @param name
* @return
*/
- static public String validateColumnType(String type) {
+ static public String validateColumnType(String type, Configuration conf) {
if (type.equals(TYPE_FROM_DESERIALIZER)) return null;
- if (type.length() > MAX_MS_TYPENAME_LENGTH) {
- return "type name is too long: " + type;
+ int maxLen = HiveConf.getIntVar(conf, HiveConf.ConfVars.METASTORE_MAX_TYPENAME_LENGTH);
+ if (type.length() > maxLen) {
+ return "type name length " + type.length() + " exceeds max allowed length " + maxLen
+ + ", type " + type;
}
int last = 0;
boolean lastAlphaDigit = isValidTypeChar(type.charAt(last));