arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jul...@apache.org
Subject arrow git commit: ARROW-1101: Implement write(TypeHolder) methods in UnionListWriter
Date Thu, 08 Jun 2017 00:01:34 GMT
Repository: arrow
Updated Branches:
  refs/heads/master e3f235f52 -> 81c4bd695


ARROW-1101: Implement write(TypeHolder) methods in UnionListWriter

Author: vkorukanti <venki@dremio.com>

Closes #740 from vkorukanti/ARROW-1101 and squashes the following commits:

e2d097d [vkorukanti] ARROW-1101: Implement write(TypeHolder) methods in UnionListWriter


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

Branch: refs/heads/master
Commit: 81c4bd695f8156cc9cdf280eae3368c42c953aa6
Parents: e3f235f
Author: vkorukanti <venki@dremio.com>
Authored: Wed Jun 7 17:01:30 2017 -0700
Committer: Julien Le Dem <julien@apache.org>
Committed: Wed Jun 7 17:01:30 2017 -0700

----------------------------------------------------------------------
 java/vector/src/main/codegen/templates/UnionListWriter.java | 5 +++++
 .../arrow/vector/complex/writer/TestComplexWriter.java      | 9 ++++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/81c4bd69/java/vector/src/main/codegen/templates/UnionListWriter.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/UnionListWriter.java b/java/vector/src/main/codegen/templates/UnionListWriter.java
index d6e2f9f..9fe41d0 100644
--- a/java/vector/src/main/codegen/templates/UnionListWriter.java
+++ b/java/vector/src/main/codegen/templates/UnionListWriter.java
@@ -166,6 +166,11 @@ public class UnionListWriter extends AbstractFieldWriter {
     writer.setPosition(writer.idx()+1);
   }
 
+  public void write(${name}Holder holder) {
+    writer.write${name}(<#list fields as field>holder.${field.name}<#if field_has_next>,
</#if></#list>);
+    writer.setPosition(writer.idx()+1);
+  }
+
       </#if>
     </#list>
   </#list>

http://git-wip-us.apache.org/repos/asf/arrow/blob/81c4bd69/java/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java
----------------------------------------------------------------------
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java
b/java/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java
index ede8d65..5a9c80d 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java
@@ -42,6 +42,7 @@ import org.apache.arrow.vector.complex.reader.FieldReader;
 import org.apache.arrow.vector.complex.writer.BaseWriter.ComplexWriter;
 import org.apache.arrow.vector.complex.writer.BaseWriter.ListWriter;
 import org.apache.arrow.vector.complex.writer.BaseWriter.MapWriter;
+import org.apache.arrow.vector.holders.IntHolder;
 import org.apache.arrow.vector.holders.NullableTimeStampNanoTZHolder;
 import org.apache.arrow.vector.types.pojo.ArrowType;
 import org.apache.arrow.vector.types.pojo.ArrowType.ArrowTypeID;
@@ -216,7 +217,13 @@ public class TestComplexWriter {
     for (int i = 0; i < COUNT; i++) {
       listWriter.startList();
       for (int j = 0; j < i % 7; j++) {
-        listWriter.writeInt(j);
+        if (j%2 == 0) {
+          listWriter.writeInt(j);
+        } else {
+          IntHolder holder = new IntHolder();
+          holder.value = j;
+          listWriter.write(holder);
+        }
       }
       listWriter.endList();
     }


Mime
View raw message