arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject arrow git commit: ARROW-269: Include typeVector buffers UnionVector.getBuffers()
Date Mon, 22 Aug 2016 20:11:52 GMT
Repository: arrow
Updated Branches:
  refs/heads/master 8960a2ed4 -> ec51d5667


ARROW-269: Include typeVector buffers UnionVector.getBuffers()


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

Branch: refs/heads/master
Commit: ec51d566708f5d6ea0a94a6d53152dc8cc98d6aa
Parents: 8960a2e
Author: Steven Phillips <steven@dremio.com>
Authored: Mon Aug 22 13:10:06 2016 -0700
Committer: Steven Phillips <steven@dremio.com>
Committed: Mon Aug 22 13:10:58 2016 -0700

----------------------------------------------------------------------
 .../src/main/codegen/templates/UnionVector.java | 24 +++++++++-----------
 1 file changed, 11 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/ec51d566/java/vector/src/main/codegen/templates/UnionVector.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/UnionVector.java b/java/vector/src/main/codegen/templates/UnionVector.java
index e2f19f4..1fef490 100644
--- a/java/vector/src/main/codegen/templates/UnionVector.java
+++ b/java/vector/src/main/codegen/templates/UnionVector.java
@@ -16,7 +16,9 @@
  * limitations under the License.
  */
 
+import com.google.common.collect.ImmutableList;
 import com.google.flatbuffers.FlatBufferBuilder;
+import io.netty.buffer.ArrowBuf;
 import org.apache.arrow.flatbuf.Field;
 import org.apache.arrow.flatbuf.Type;
 import org.apache.arrow.flatbuf.Union;
@@ -35,6 +37,7 @@ import java.util.List;
 package org.apache.arrow.vector.complex;
 
 <#include "/@includes/vv_imports.ftl" />
+import com.google.common.collect.ImmutableList;
 import java.util.ArrayList;
 import java.util.Iterator;
 import org.apache.arrow.vector.complex.impl.ComplexCopier;
@@ -219,6 +222,7 @@ public class UnionVector implements ValueVector {
   }
 
   public void transferTo(org.apache.arrow.vector.complex.UnionVector target) {
+    typeVector.makeTransferPair(target.typeVector).transfer();
     internalMap.makeTransferPair(target.internalMap).transfer();
     target.valueCount = valueCount;
   }
@@ -307,20 +311,9 @@ public class UnionVector implements ValueVector {
     return mutator.writer;
   }
 
-//  @Override
-//  public UserBitShared.SerializedField getMetadata() {
-//    SerializedField.Builder b = getField() //
-//            .getAsBuilder() //
-//            .setBufferLength(getBufferSize()) //
-//            .setValueCount(valueCount);
-//
-//    b.addChild(internalMap.getMetadata());
-//    return b.build();
-//  }
-
   @Override
   public int getBufferSize() {
-    return internalMap.getBufferSize();
+    return typeVector.getBufferSize() + internalMap.getBufferSize();
   }
 
   @Override
@@ -339,7 +332,11 @@ public class UnionVector implements ValueVector {
 
   @Override
   public ArrowBuf[] getBuffers(boolean clear) {
-    return internalMap.getBuffers(clear);
+    ImmutableList.Builder<ArrowBuf> builder = ImmutableList.builder();
+    builder.add(typeVector.getBuffers(clear));
+    builder.add(internalMap.getBuffers(clear));
+    List<ArrowBuf> list = builder.build();
+    return list.toArray(new ArrowBuf[list.size()]);
   }
 
   @Override
@@ -411,6 +408,7 @@ public class UnionVector implements ValueVector {
     @Override
     public void setValueCount(int valueCount) {
       UnionVector.this.valueCount = valueCount;
+      typeVector.getMutator().setValueCount(valueCount);
       internalMap.getMutator().setValueCount(valueCount);
     }
 


Mime
View raw message