You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ha...@apache.org on 2016/07/16 18:10:38 UTC

hive git commit: HIVE-14244 : bucketmap right outer join query throws ArrayIndexOutOfBoundsException (Zhiyuan Yang via Gunther Hagleitner)

Repository: hive
Updated Branches:
  refs/heads/master 04597681d -> 70a972205


HIVE-14244 : bucketmap right outer join query throws ArrayIndexOutOfBoundsException (Zhiyuan Yang via Gunther Hagleitner)

Signed-off-by: Ashutosh Chauhan <ha...@apache.org>


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

Branch: refs/heads/master
Commit: 70a9722057728b6f80950c743e47bedf17ed6625
Parents: 0459768
Author: Zhiyuan Yang <sj...@gmail.com>
Authored: Sat Jul 16 11:06:11 2016 -0700
Committer: Ashutosh Chauhan <ha...@apache.org>
Committed: Sat Jul 16 11:06:11 2016 -0700

----------------------------------------------------------------------
 .../hive/ql/exec/tez/CustomPartitionVertex.java |  2 +-
 .../ql/exec/tez/TestCustomPartitionVertex.java  | 43 ++++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/70a97220/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/CustomPartitionVertex.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/CustomPartitionVertex.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/CustomPartitionVertex.java
index 45d3cd1..8974e9b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/CustomPartitionVertex.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/CustomPartitionVertex.java
@@ -493,7 +493,7 @@ public class CustomPartitionVertex extends VertexManagerPlugin {
 
   UserPayload getBytePayload(Multimap<Integer, Integer> routingTable) throws IOException {
     CustomEdgeConfiguration edgeConf =
-        new CustomEdgeConfiguration(routingTable.keySet().size(), routingTable);
+        new CustomEdgeConfiguration(numBuckets, routingTable);
     DataOutputBuffer dob = new DataOutputBuffer();
     edgeConf.write(dob);
     byte[] serialized = dob.getData();

http://git-wip-us.apache.org/repos/asf/hive/blob/70a97220/ql/src/test/org/apache/hadoop/hive/ql/exec/tez/TestCustomPartitionVertex.java
----------------------------------------------------------------------
diff --git a/ql/src/test/org/apache/hadoop/hive/ql/exec/tez/TestCustomPartitionVertex.java b/ql/src/test/org/apache/hadoop/hive/ql/exec/tez/TestCustomPartitionVertex.java
new file mode 100644
index 0000000..dbdd955
--- /dev/null
+++ b/ql/src/test/org/apache/hadoop/hive/ql/exec/tez/TestCustomPartitionVertex.java
@@ -0,0 +1,43 @@
+package org.apache.hadoop.hive.ql.exec.tez;
+
+import com.google.common.collect.HashMultimap;
+import com.google.common.collect.Multimap;
+import org.apache.hadoop.hive.ql.plan.TezWork;
+import org.apache.hadoop.io.DataOutputBuffer;
+import org.apache.tez.dag.api.UserPayload;
+import org.apache.tez.dag.api.VertexManagerPluginContext;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+public class TestCustomPartitionVertex {
+    @Test(timeout = 5000)
+    public void testGetBytePayload() throws IOException {
+        int numBuckets = 10;
+        VertexManagerPluginContext context = mock(VertexManagerPluginContext.class);
+        CustomVertexConfiguration vertexConf =
+                new CustomVertexConfiguration(numBuckets, TezWork.VertexType.INITIALIZED_EDGES);
+        DataOutputBuffer dob = new DataOutputBuffer();
+        vertexConf.write(dob);
+        UserPayload payload = UserPayload.create(ByteBuffer.wrap(dob.getData()));
+        when(context.getUserPayload()).thenReturn(payload);
+
+        CustomPartitionVertex vm = new CustomPartitionVertex(context);
+        vm.initialize();
+
+        // prepare empty routing table
+        Multimap<Integer, Integer> routingTable = HashMultimap.<Integer, Integer> create();
+        payload = vm.getBytePayload(routingTable);
+        // get conf from user payload
+        CustomEdgeConfiguration edgeConf = new CustomEdgeConfiguration();
+        DataInputByteBuffer dibb = new DataInputByteBuffer();
+        dibb.reset(payload.getPayload());
+        edgeConf.readFields(dibb);
+        assertEquals(numBuckets, edgeConf.getNumBuckets());
+    }
+}