You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@phoenix.apache.org by ss...@apache.org on 2016/11/02 20:08:32 UTC
[10/18] phoenix git commit: PHOENIX-3386 PhoenixStorageHandler throws
NPE if local tasks executed via child
PHOENIX-3386 PhoenixStorageHandler throws NPE if local tasks executed via child
Signed-off-by: Sergey Soldatov <ss...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/phoenix/repo
Commit: http://git-wip-us.apache.org/repos/asf/phoenix/commit/cf70820b
Tree: http://git-wip-us.apache.org/repos/asf/phoenix/tree/cf70820b
Diff: http://git-wip-us.apache.org/repos/asf/phoenix/diff/cf70820b
Branch: refs/heads/4.x-HBase-0.98
Commit: cf70820b9dee6968ac26c66c5c98079158a48ac1
Parents: bebcc55
Author: Sergey Soldatov <ss...@apache.org>
Authored: Mon Oct 24 22:11:52 2016 -0700
Committer: Sergey Soldatov <ss...@apache.org>
Committed: Wed Nov 2 12:58:40 2016 -0700
----------------------------------------------------------------------
.../apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java | 2 ++
.../java/org/apache/phoenix/hive/PhoenixStorageHandler.java | 4 ++++
.../org/apache/phoenix/hive/util/PhoenixStorageHandlerUtil.java | 5 ++---
3 files changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cf70820b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
index b1879d1..2264acd 100644
--- a/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
+++ b/phoenix-core/src/main/java/org/apache/phoenix/mapreduce/util/PhoenixConfigurationUtil.java
@@ -55,6 +55,8 @@ import com.google.common.collect.Lists;
public final class PhoenixConfigurationUtil {
private static final Log LOG = LogFactory.getLog(PhoenixInputFormat.class);
+
+ public static final String SESSION_ID = "phoenix.sessionid";
public static final String UPSERT_STATEMENT = "phoenix.upsert.stmt";
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cf70820b/phoenix-hive/src/main/java/org/apache/phoenix/hive/PhoenixStorageHandler.java
----------------------------------------------------------------------
diff --git a/phoenix-hive/src/main/java/org/apache/phoenix/hive/PhoenixStorageHandler.java b/phoenix-hive/src/main/java/org/apache/phoenix/hive/PhoenixStorageHandler.java
index 2bc8ace..bda2282 100644
--- a/phoenix-hive/src/main/java/org/apache/phoenix/hive/PhoenixStorageHandler.java
+++ b/phoenix-hive/src/main/java/org/apache/phoenix/hive/PhoenixStorageHandler.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.hive.ql.metadata.HiveStoragePredicateHandler;
import org.apache.hadoop.hive.ql.metadata.InputEstimator;
import org.apache.hadoop.hive.ql.plan.ExprNodeDesc;
import org.apache.hadoop.hive.ql.plan.TableDesc;
+import org.apache.hadoop.hive.ql.session.SessionState;
import org.apache.hadoop.hive.serde2.Deserializer;
import org.apache.hadoop.hive.serde2.SerDe;
import org.apache.hadoop.mapred.InputFormat;
@@ -142,7 +143,10 @@ public class PhoenixStorageHandler extends DefaultStorageHandler implements
tableProperties.setProperty(PhoenixStorageHandlerConstants.PHOENIX_TABLE_NAME,
tableName);
}
+ SessionState sessionState = SessionState.get();
+ String sessionId = sessionState.getSessionId();
+ jobProperties.put(PhoenixConfigurationUtil.SESSION_ID, sessionId);
jobProperties.put(PhoenixConfigurationUtil.INPUT_TABLE_NAME, tableName);
jobProperties.put(PhoenixStorageHandlerConstants.ZOOKEEPER_QUORUM, tableProperties
.getProperty(PhoenixStorageHandlerConstants.ZOOKEEPER_QUORUM,
http://git-wip-us.apache.org/repos/asf/phoenix/blob/cf70820b/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixStorageHandlerUtil.java
----------------------------------------------------------------------
diff --git a/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixStorageHandlerUtil.java b/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixStorageHandlerUtil.java
index eb5fd24..1313fdb 100644
--- a/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixStorageHandlerUtil.java
+++ b/phoenix-hive/src/main/java/org/apache/phoenix/hive/util/PhoenixStorageHandlerUtil.java
@@ -33,6 +33,7 @@ import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.net.DNS;
import org.apache.phoenix.hive.constants.PhoenixStorageHandlerConstants;
import org.apache.phoenix.hive.ql.index.IndexSearchCondition;
+import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil;
import javax.naming.NamingException;
import java.io.ByteArrayInputStream;
@@ -182,10 +183,8 @@ public class PhoenixStorageHandlerUtil {
}
public static String getTableKeyOfSession(JobConf jobConf, String tableName) {
- SessionState sessionState = SessionState.get();
-
- String sessionId = sessionState.getSessionId();
+ String sessionId = jobConf.get(PhoenixConfigurationUtil.SESSION_ID);
return new StringBuilder("[").append(sessionId).append("]-").append(tableName).toString();
}