FAQ
Repository: hive
Updated Branches:
   refs/heads/branch-2.1 1bc13cb36 -> 185d9c572


HIVE-13972 : Resolve class dependency issue introduced by HIVE-13354 (Wei Zheng, reviewed by Eugene Koifman)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/185d9c57
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/185d9c57
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/185d9c57

Branch: refs/heads/branch-2.1
Commit: 185d9c57269cc6b673aa3950a8909b7157cd0197
Parents: 1bc13cb
Author: Wei Zheng <weiz@apache.org>
Authored: Wed Jun 8 13:26:14 2016 -0700
Committer: Wei Zheng <weiz@apache.org>
Committed: Wed Jun 8 13:26:14 2016 -0700

----------------------------------------------------------------------
  .../hadoop/hive/common/StringableMap.java | 80 ++++++++++++++++++++
  .../hadoop/hive/metastore/txn/TxnHandler.java | 2 +-
  .../hadoop/hive/metastore/txn/TxnUtils.java | 54 -------------
  .../hive/ql/txn/compactor/CompactorMR.java | 2 +-
  .../hive/ql/txn/compactor/TestWorker.java | 2 +-
  5 files changed, 83 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/185d9c57/common/src/java/org/apache/hadoop/hive/common/StringableMap.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/common/StringableMap.java b/common/src/java/org/apache/hadoop/hive/common/StringableMap.java
new file mode 100644
index 0000000..8a93c0f
--- /dev/null
+++ b/common/src/java/org/apache/hadoop/hive/common/StringableMap.java
@@ -0,0 +1,80 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.hive.common;
+
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+/**
+ * A utility class that can convert a HashMap of Properties into a colon separated string,
+ * and can take the same format of string and convert it to a HashMap of Properties.
+ */
+public class StringableMap extends HashMap<String, String> {
+
+ public StringableMap(String s) {
+ String[] parts = s.split(":", 2);
+ // read that many chars
+ int numElements = Integer.parseInt(parts[0]);
+ s = parts[1];
+ for (int i = 0; i < numElements; i++) {
+ parts = s.split(":", 2);
+ int len = Integer.parseInt(parts[0]);
+ String key = null;
+ if (len > 0) key = parts[1].substring(0, len);
+ parts = parts[1].substring(len).split(":", 2);
+ len = Integer.parseInt(parts[0]);
+ String value = null;
+ if (len > 0) value = parts[1].substring(0, len);
+ s = parts[1].substring(len);
+ put(key, value);
+ }
+ }
+
+ public StringableMap(Map<String, String> m) {
+ super(m);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder buf = new StringBuilder();
+ buf.append(size());
+ buf.append(':');
+ if (size() > 0) {
+ for (Map.Entry<String, String> entry : entrySet()) {
+ int length = (entry.getKey() == null) ? 0 : entry.getKey().length();
+ buf.append(entry.getKey() == null ? 0 : length);
+ buf.append(':');
+ if (length > 0) buf.append(entry.getKey());
+ length = (entry.getValue() == null) ? 0 : entry.getValue().length();
+ buf.append(length);
+ buf.append(':');
+ if (length > 0) buf.append(entry.getValue());
+ }
+ }
+ return buf.toString();
+ }
+
+ public Properties toProperties() {
+ Properties props = new Properties();
+ props.putAll(this);
+ return props;
+ }
+}

http://git-wip-us.apache.org/repos/asf/hive/blob/185d9c57/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java b/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
index dd7054b..7a89a0c 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
@@ -37,9 +37,9 @@ import org.apache.commons.dbcp.PoolingDataSource;
  import org.apache.commons.pool.ObjectPool;
  import org.apache.commons.pool.impl.GenericObjectPool;
  import org.apache.hadoop.hive.common.JavaUtils;
+import org.apache.hadoop.hive.common.StringableMap;
  import org.apache.hadoop.hive.conf.HiveConf;
  import org.apache.hadoop.hive.metastore.api.*;
-import org.apache.hadoop.hive.metastore.txn.TxnUtils.StringableMap;
  import org.apache.hadoop.hive.shims.ShimLoader;
  import org.apache.hadoop.util.StringUtils;


http://git-wip-us.apache.org/repos/asf/hive/blob/185d9c57/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java b/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java
index 644aed1..46348ea 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnUtils.java
@@ -30,10 +30,8 @@ import org.apache.hadoop.hive.metastore.api.hive_metastoreConstants;
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;

-import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
-import java.util.Properties;
  import java.util.Set;

  public class TxnUtils {
@@ -211,56 +209,4 @@ public class TxnUtils {
      long sizeInBytes = 8 * (((sb.length() * 2) + 45) / 8);
      return sizeInBytes / 1024 > queryMemoryLimit;
    }
-
- public static class StringableMap extends HashMap<String, String> {
-
- public StringableMap(String s) {
- String[] parts = s.split(":", 2);
- // read that many chars
- int numElements = Integer.parseInt(parts[0]);
- s = parts[1];
- for (int i = 0; i < numElements; i++) {
- parts = s.split(":", 2);
- int len = Integer.parseInt(parts[0]);
- String key = null;
- if (len > 0) key = parts[1].substring(0, len);
- parts = parts[1].substring(len).split(":", 2);
- len = Integer.parseInt(parts[0]);
- String value = null;
- if (len > 0) value = parts[1].substring(0, len);
- s = parts[1].substring(len);
- put(key, value);
- }
- }
-
- public StringableMap(Map<String, String> m) {
- super(m);
- }
-
- @Override
- public String toString() {
- StringBuilder buf = new StringBuilder();
- buf.append(size());
- buf.append(':');
- if (size() > 0) {
- for (Map.Entry<String, String> entry : entrySet()) {
- int length = (entry.getKey() == null) ? 0 : entry.getKey().length();
- buf.append(entry.getKey() == null ? 0 : length);
- buf.append(':');
- if (length > 0) buf.append(entry.getKey());
- length = (entry.getValue() == null) ? 0 : entry.getValue().length();
- buf.append(length);
- buf.append(':');
- if (length > 0) buf.append(entry.getValue());
- }
- }
- return buf.toString();
- }
-
- public Properties toProperties() {
- Properties props = new Properties();
- props.putAll(this);
- return props;
- }
- }
  }

http://git-wip-us.apache.org/repos/asf/hive/blob/185d9c57/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorMR.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorMR.java b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorMR.java
index 3a5a325..37c5314 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorMR.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/txn/compactor/CompactorMR.java
@@ -25,6 +25,7 @@ import org.apache.hadoop.fs.FileStatus;
  import org.apache.hadoop.fs.FileSystem;
  import org.apache.hadoop.fs.Path;
  import org.apache.hadoop.hive.common.JavaUtils;
+import org.apache.hadoop.hive.common.StringableMap;
  import org.apache.hadoop.hive.common.ValidTxnList;
  import org.apache.hadoop.hive.common.ValidReadTxnList;
  import org.apache.hadoop.hive.conf.HiveConf;
@@ -33,7 +34,6 @@ import org.apache.hadoop.hive.metastore.api.FieldSchema;
  import org.apache.hadoop.hive.metastore.api.StorageDescriptor;
  import org.apache.hadoop.hive.metastore.api.Table;
  import org.apache.hadoop.hive.metastore.txn.CompactionInfo;
-import org.apache.hadoop.hive.metastore.txn.TxnUtils.StringableMap;
  import org.apache.hadoop.hive.ql.exec.FileSinkOperator.RecordWriter;
  import org.apache.hadoop.hive.ql.io.AcidInputFormat;
  import org.apache.hadoop.hive.ql.io.AcidOutputFormat;

http://git-wip-us.apache.org/repos/asf/hive/blob/185d9c57/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java
index ef7804c..e85f49c 100644
--- a/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java
+++ b/ql/src/test/org/apache/hadoop/hive/ql/txn/compactor/TestWorker.java
@@ -21,6 +21,7 @@ import org.apache.hadoop.fs.FSDataOutputStream;
  import org.apache.hadoop.fs.FileStatus;
  import org.apache.hadoop.fs.FileSystem;
  import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hive.common.StringableMap;
  import org.apache.hadoop.hive.conf.HiveConf;
  import org.apache.hadoop.hive.metastore.api.CompactionRequest;
  import org.apache.hadoop.hive.metastore.api.CompactionType;
@@ -31,7 +32,6 @@ import org.apache.hadoop.hive.metastore.api.ShowCompactResponse;
  import org.apache.hadoop.hive.metastore.api.ShowCompactResponseElement;
  import org.apache.hadoop.hive.metastore.api.Table;
  import org.apache.hadoop.hive.metastore.txn.TxnStore;
-import org.apache.hadoop.hive.metastore.txn.TxnUtils.StringableMap;
  import org.apache.hadoop.hive.ql.io.AcidUtils;
  import org.junit.Assert;
  import org.junit.Test;

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedJun 8, '16 at 8:25p
activeJun 8, '16 at 8:53p
posts3
users1
websitehive.apache.org

1 user in discussion

Weiz: 3 posts

People

Translate

site design / logo © 2021 Grokbase