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-326: Include scale and precision when materializing decimal writer
Date Tue, 11 Oct 2016 03:11:12 GMT
Repository: arrow
Updated Branches:
  refs/heads/master fb799bc8f -> 8c8d341e1


ARROW-326: Include scale and precision when materializing decimal writer

closes #166


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

Branch: refs/heads/master
Commit: 8c8d341e12efcedecd3c2545aaf349bf5f899bc1
Parents: fb799bc
Author: Steven Phillips <steven@dremio.com>
Authored: Mon Oct 10 13:42:41 2016 -0700
Committer: Steven Phillips <steven@dremio.com>
Committed: Mon Oct 10 20:09:32 2016 -0700

----------------------------------------------------------------------
 java/vector/src/main/codegen/templates/MapWriters.java      | 5 +++++
 .../arrow/vector/complex/impl/TestPromotableWriter.java     | 9 ++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/8c8d341e/java/vector/src/main/codegen/templates/MapWriters.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/MapWriters.java b/java/vector/src/main/codegen/templates/MapWriters.java
index 9fe20df..696bbf6 100644
--- a/java/vector/src/main/codegen/templates/MapWriters.java
+++ b/java/vector/src/main/codegen/templates/MapWriters.java
@@ -73,7 +73,12 @@ public class ${mode}MapWriter extends AbstractFieldWriter {
 <#if lowerName == "int" ><#assign lowerName = "integer" /></#if>
 <#assign upperName = minor.class?upper_case />
       case ${upperName}:
+        <#if lowerName == "decimal" >
+        Decimal decimal = (Decimal)child.getType();
+        decimal(child.getName(), decimal.getScale(), decimal.getPrecision());
+        <#else>
         ${lowerName}(child.getName());
+       </#if>
         break;
 </#list></#list>
       }

http://git-wip-us.apache.org/repos/asf/arrow/blob/8c8d341e/java/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java
----------------------------------------------------------------------
diff --git a/java/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java
b/java/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java
index d439ceb..176ad51 100644
--- a/java/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java
+++ b/java/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java
@@ -67,6 +67,8 @@ public class TestPromotableWriter {
       writer.setPosition(1);
       writer.bit("A").writeBit(1);
 
+      writer.decimal("dec", 10,10);
+
       writer.setPosition(2);
       writer.integer("A").writeInt(10);
 
@@ -108,9 +110,10 @@ public class TestPromotableWriter {
       newMapWriter.setPosition(2);
       newMapWriter.integer("A").writeInt(10);
 
-      Field childField = container.getField().getChildren().get(0).getChildren().get(0);
-      assertEquals("Child field should be union type: " + childField.getName(), Type.Union,
childField.getType().getTypeType());
-
+      Field childField1 = container.getField().getChildren().get(0).getChildren().get(0);
+      Field childField2 = container.getField().getChildren().get(0).getChildren().get(1);
+      assertEquals("Child field should be union type: " + childField1.getName(), Type.Union,
childField1.getType().getTypeType());
+      assertEquals("Child field should be decimal type: " + childField2.getName(), Type.Decimal,
childField2.getType().getTypeType());
     }
   }
 }


Mime
View raw message