diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/ObjectCacheFactory.java ql/src/java/org/apache/hadoop/hive/ql/exec/ObjectCacheFactory.java index 5a19030..ef5c9b1 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/ObjectCacheFactory.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/ObjectCacheFactory.java @@ -56,8 +56,13 @@ public static ObjectCache getCache(Configuration conf, String queryId, boolean i new org.apache.hadoop.hive.ql.exec.mr.ObjectCache(), queryId); } } else { // container - return new ObjectCacheWrapper( - new org.apache.hadoop.hive.ql.exec.tez.ObjectCache(), queryId); + if (org.apache.hadoop.hive.ql.exec.tez.ObjectCache.isObjectRegistryConfigured()) { + return new ObjectCacheWrapper( + new org.apache.hadoop.hive.ql.exec.tez.ObjectCache(), queryId); + } else { + // Tez processor needs to configure object registry first. + return null; + } } } else { // mr or spark return new ObjectCacheWrapper( diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java index 72dcdd3..3b234ea 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java @@ -54,6 +54,11 @@ public ObjectCache() { registry = staticRegistry; } + public static boolean isObjectRegistryConfigured() { + return (staticRegistry != null); + } + + public static void setupObjectRegistry(ObjectRegistry objectRegistry) { staticRegistry = objectRegistry; staticPool = Executors.newCachedThreadPool(); diff --git ql/src/java/org/apache/hadoop/hive/ql/plan/DynamicValue.java ql/src/java/org/apache/hadoop/hive/ql/plan/DynamicValue.java index 874c62b..613c607 100644 --- ql/src/java/org/apache/hadoop/hive/ql/plan/DynamicValue.java +++ ql/src/java/org/apache/hadoop/hive/ql/plan/DynamicValue.java @@ -115,6 +115,10 @@ public Object getValue() { String queryId = HiveConf.getVar(conf, HiveConf.ConfVars.HIVEQUERYID); ObjectCache cache = ObjectCacheFactory.getCache(conf, queryId, false); + if (cache == null) { + return null; + } + // Get the registry DynamicValueRegistry valueRegistry = cache.retrieve(DYNAMIC_VALUE_REGISTRY_CACHE_KEY); if (valueRegistry == null) { diff --git storage-api/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java storage-api/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java index 6d8c83b..85273f9 100644 --- storage-api/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java +++ storage-api/src/java/org/apache/hadoop/hive/ql/io/sarg/SearchArgumentImpl.java @@ -117,7 +117,10 @@ public Object getLiteral() { if (literalList != null && literalList.size() > 0 && literalList.get(0) instanceof LiteralDelegate) { List newLiteraList = new ArrayList(); for (Object litertalObj : literalList) { - newLiteraList.add(((LiteralDelegate) litertalObj).getLiteral()); + Object literal = ((LiteralDelegate) litertalObj).getLiteral(); + if (literal != null) { + newLiteraList.add(literal); + } } return newLiteraList; }