You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2016/06/02 14:47:54 UTC
hive git commit: HIVE-13902 : [Refactor] Minimize metastore jar
dependencies on task nodes (Ashutosh Chauhan via Sergey Shelukhin)
Repository: hive
Updated Branches:
refs/heads/master b267500fa -> 8d34a3d57
HIVE-13902 : [Refactor] Minimize metastore jar dependencies on task nodes (Ashutosh Chauhan via Sergey Shelukhin)
Signed-off-by: Ashutosh Chauhan <ha...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/8d34a3d5
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/8d34a3d5
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/8d34a3d5
Branch: refs/heads/master
Commit: 8d34a3d5721e5a26cd4882ec3ba9fa41613327d3
Parents: b267500
Author: Ashutosh Chauhan <ha...@apache.org>
Authored: Tue May 31 23:18:00 2016 -0800
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Thu Jun 2 07:46:29 2016 -0700
----------------------------------------------------------------------
.../hive/common/util/HiveStringUtils.java | 17 +++++++++++++++++
.../hadoop/hive/metastore/MetaStoreUtils.java | 20 +++-----------------
.../hadoop/hive/ql/exec/FileSinkOperator.java | 4 ++--
3 files changed, 22 insertions(+), 19 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/8d34a3d5/common/src/java/org/apache/hive/common/util/HiveStringUtils.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hive/common/util/HiveStringUtils.java b/common/src/java/org/apache/hive/common/util/HiveStringUtils.java
index 6d28396..bba14e2 100644
--- a/common/src/java/org/apache/hive/common/util/HiveStringUtils.java
+++ b/common/src/java/org/apache/hive/common/util/HiveStringUtils.java
@@ -38,9 +38,11 @@ import java.util.HashMap;
import java.util.Locale;
import java.util.Properties;
import java.util.StringTokenizer;
+import java.util.regex.Pattern;
import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
+
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.common.classification.InterfaceAudience;
import org.apache.hadoop.hive.common.classification.InterfaceStability;
@@ -958,4 +960,19 @@ public class HiveStringUtils {
}
return false;
}
+
+ public static String getPartitionValWithInvalidCharacter(List<String> partVals,
+ Pattern partitionValidationPattern) {
+ if (partitionValidationPattern == null) {
+ return null;
+ }
+
+ for (String partVal : partVals) {
+ if (!partitionValidationPattern.matcher(partVal).matches()) {
+ return partVal;
+ }
+ }
+
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/hive/blob/8d34a3d5/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 84b24ab..2f1e460 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/MetaStoreUtils.java
@@ -86,6 +86,7 @@ import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
import org.apache.hadoop.hive.shims.ShimLoader;
import org.apache.hadoop.hive.thrift.HadoopThriftAuthBridge;
+import org.apache.hive.common.util.HiveStringUtils;
import org.apache.hive.common.util.ReflectionUtil;
import javax.annotation.Nullable;
@@ -1631,7 +1632,7 @@ public class MetaStoreUtils {
Pattern partitionValidationPattern) throws MetaException {
String invalidPartitionVal =
- getPartitionValWithInvalidCharacter(partVals, partitionValidationPattern);
+ HiveStringUtils.getPartitionValWithInvalidCharacter(partVals, partitionValidationPattern);
if (invalidPartitionVal != null) {
throw new MetaException("Partition value '" + invalidPartitionVal +
"' contains a character " + "not matched by whitelist pattern '" +
@@ -1642,7 +1643,7 @@ public class MetaStoreUtils {
public static boolean partitionNameHasValidCharacters(List<String> partVals,
Pattern partitionValidationPattern) {
- return getPartitionValWithInvalidCharacter(partVals, partitionValidationPattern) == null;
+ return HiveStringUtils.getPartitionValWithInvalidCharacter(partVals, partitionValidationPattern) == null;
}
/**
@@ -1692,21 +1693,6 @@ public class MetaStoreUtils {
}
- public static String getPartitionValWithInvalidCharacter(List<String> partVals,
- Pattern partitionValidationPattern) {
- if (partitionValidationPattern == null) {
- return null;
- }
-
- for (String partVal : partVals) {
- if (!partitionValidationPattern.matcher(partVal).matches()) {
- return partVal;
- }
- }
-
- return null;
- }
-
public static String ARCHIVING_LEVEL = "archiving_level";
public static int getArchivingLevel(Partition part) throws MetaException {
if (!isArchived(part)) {
http://git-wip-us.apache.org/repos/asf/hive/blob/8d34a3d5/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
index cd5e7e7..556d273 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
@@ -39,7 +39,6 @@ import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hive.common.FileUtils;
import org.apache.hadoop.hive.common.StatsSetupConst;
import org.apache.hadoop.hive.conf.HiveConf;
-import org.apache.hadoop.hive.metastore.MetaStoreUtils;
import org.apache.hadoop.hive.ql.CompilationOpContext;
import org.apache.hadoop.hive.ql.ErrorMsg;
import org.apache.hadoop.hive.ql.io.AcidUtils;
@@ -79,6 +78,7 @@ import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.util.ReflectionUtils;
+import org.apache.hive.common.util.HiveStringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -702,7 +702,7 @@ public class FileSinkOperator extends TerminalOperator<FileSinkDesc> implements
}
String invalidPartitionVal;
- if((invalidPartitionVal = MetaStoreUtils.getPartitionValWithInvalidCharacter(dpVals, dpCtx.getWhiteListPattern()))!=null) {
+ if((invalidPartitionVal = HiveStringUtils.getPartitionValWithInvalidCharacter(dpVals, dpCtx.getWhiteListPattern()))!=null) {
throw new HiveFatalException("Partition value '" + invalidPartitionVal +
"' contains a character not matched by whitelist pattern '" +
dpCtx.getWhiteListPattern().toString() + "'. " + "(configure with " +