hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gunt...@apache.org
Subject svn commit: r1669689 - /hive/branches/llap/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinBytesTableContainer.java
Date Fri, 27 Mar 2015 21:26:55 GMT
Author: gunther
Date: Fri Mar 27 21:26:55 2015
New Revision: 1669689

URL: http://svn.apache.org/r1669689
Log:
HIVE-10082: Addendum: LLAP: UnwrappedRowContainer throws exceptions (Gunther Hagleitner)

Modified:
    hive/branches/llap/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinBytesTableContainer.java

Modified: hive/branches/llap/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinBytesTableContainer.java
URL: http://svn.apache.org/viewvc/hive/branches/llap/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinBytesTableContainer.java?rev=1669689&r1=1669688&r2=1669689&view=diff
==============================================================================
--- hive/branches/llap/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinBytesTableContainer.java
(original)
+++ hive/branches/llap/ql/src/java/org/apache/hadoop/hive/ql/exec/persistence/MapJoinBytesTableContainer.java
Fri Mar 27 21:26:55 2015
@@ -423,12 +423,14 @@ public class MapJoinBytesTableContainer
     }
 
     public void setFromOutput(Output output) {
-      if (refs == null) {
-        refs = new ArrayList<WriteBuffers.ByteSegmentRef>(0);
+      synchronized (hashMap) {
+        if (refs == null) {
+          refs = new ArrayList<WriteBuffers.ByteSegmentRef>(0);
+        }
+        byte aliasFilter = hashMap.getValueRefs(output.getData(), output.getLength(), refs);
+        this.aliasFilter = refs.isEmpty() ? (byte) 0xff : aliasFilter;
+        this.dummyRow = null;
       }
-      byte aliasFilter = hashMap.getValueRefs(output.getData(), output.getLength(), refs);
-      this.aliasFilter = refs.isEmpty() ? (byte) 0xff : aliasFilter;
-      this.dummyRow = null;
     }
 
     public boolean isEmpty() {
@@ -478,23 +480,28 @@ public class MapJoinBytesTableContainer
 
     @Override
     public List<Object> next() throws HiveException {
-      if (dummyRow != null) {
-        List<Object> result = dummyRow;
-        dummyRow = null;
-        return result;
+      synchronized (hashMap) {
+        if (dummyRow != null) {
+          List<Object> result = dummyRow;
+          dummyRow = null;
+          return result;
+        }
+        if (currentRow < 0 || refs.size() < currentRow)
+          throw new HiveException("No rows");
+        if (refs.size() == currentRow)
+          return null;
+        WriteBuffers.ByteSegmentRef ref = refs.get(currentRow++);
+        if (ref.getLength() == 0) {
+          return EMPTY_LIST; // shortcut, 0 length means no fields
+        }
+        if (ref.getBytes() == null) {
+          hashMap.populateValue(ref);
+        }
+        uselessIndirection.setData(ref.getBytes());
+        valueStruct.init(uselessIndirection, (int) ref.getOffset(), ref.getLength());
+        return valueStruct.getFieldsAsList(); // TODO: should we unset bytes
+                                              // after that?
       }
-      if (currentRow < 0 || refs.size() < currentRow) throw new HiveException("No rows");
-      if (refs.size() == currentRow) return null;
-      WriteBuffers.ByteSegmentRef ref = refs.get(currentRow++);
-      if (ref.getLength() == 0) {
-        return EMPTY_LIST; // shortcut, 0 length means no fields
-      }
-      if (ref.getBytes() == null) {
-        hashMap.populateValue(ref);
-      }
-      uselessIndirection.setData(ref.getBytes());
-      valueStruct.init(uselessIndirection, (int)ref.getOffset(), ref.getLength());
-      return valueStruct.getFieldsAsList(); // TODO: should we unset bytes after that?
     }
 
     @Override



Mime
View raw message