You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by gu...@apache.org on 2014/09/04 00:44:01 UTC
svn commit: r1622373 - in
/hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez:
ObjectCache.java TezProcessor.java
Author: gunther
Date: Wed Sep 3 22:44:01 2014
New Revision: 1622373
URL: http://svn.apache.org/r1622373
Log:
HIVE-7809: Fix ObjectRegistry to work with Tez 0.5 (Siddharth Seth via Gunther Hagleitner)
Modified:
hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java
hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java
Modified: hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java?rev=1622373&r1=1622372&r2=1622373&view=diff
==============================================================================
--- hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java (original)
+++ hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/ObjectCache.java Wed Sep 3 22:44:01 2014
@@ -21,18 +21,35 @@ package org.apache.hadoop.hive.ql.exec.t
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.tez.runtime.api.ObjectRegistry;
-import org.apache.tez.runtime.common.objectregistry.ObjectRegistryImpl;
+
+import com.google.common.base.Preconditions;
/**
* ObjectCache. Tez implementation based on the tez object registry.
*
*/
public class ObjectCache implements org.apache.hadoop.hive.ql.exec.ObjectCache {
-
+
private static final Log LOG = LogFactory.getLog(ObjectCache.class.getName());
- // TODO HIVE-7809. This is broken. A new instance of ObjectRegistry should not be created.
- private final ObjectRegistry registry = new ObjectRegistryImpl();
+
+ // ObjectRegistry is available via the Input/Output/ProcessorContext.
+ // This is setup as part of the Tez Processor construction, so that it is available whenever an
+ // instance of the ObjectCache is created. The assumption is that Tez will initialize the Processor
+ // before anything else.
+ private volatile static ObjectRegistry staticRegistry;
+
+ private final ObjectRegistry registry;
+
+ public ObjectCache() {
+ Preconditions.checkNotNull(staticRegistry,
+ "Object registry not setup yet. This should have been setup by the TezProcessor");
+ registry = staticRegistry;
+ }
+ public static void setupObjectRegistry(ObjectRegistry objectRegistry) {
+ staticRegistry = objectRegistry;
+ }
+
@Override
public void cache(String key, Object value) {
LOG.info("Adding " + key + " to cache with value " + value);
Modified: hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java
URL: http://svn.apache.org/viewvc/hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java?rev=1622373&r1=1622372&r2=1622373&view=diff
==============================================================================
--- hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java (original)
+++ hive/branches/tez/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezProcessor.java Wed Sep 3 22:44:01 2014
@@ -69,6 +69,7 @@ public class TezProcessor extends Abstra
public TezProcessor(ProcessorContext context) {
super(context);
+ ObjectCache.setupObjectRegistry(context.getObjectRegistry());
}
@Override