Repository: arrow Updated Branches: refs/heads/master 316930cf6 -> 4e134e5b9
ARROW-1091: Decimal scale and precision are flipped Author: Julien Le Dem <jul...@apache.org> Closes #735 from julienledem/template_cleanup_followup and squashes the following commits: e968a68 [Julien Le Dem] add test 2911ea2 [Julien Le Dem] ARROW-1091: Decimal scale and precision are flipped Project: http://git-wip-us.apache.org/repos/asf/arrow/repo Commit: http://git-wip-us.apache.org/repos/asf/arrow/commit/4e134e5b Tree: http://git-wip-us.apache.org/repos/asf/arrow/tree/4e134e5b Diff: http://git-wip-us.apache.org/repos/asf/arrow/diff/4e134e5b Branch: refs/heads/master Commit: 4e134e5b9e7f093d7483f027a3de260c3c38c961 Parents: 316930c Author: Julien Le Dem <jul...@apache.org> Authored: Mon Jun 5 16:46:30 2017 -0700 Committer: Julien Le Dem <jul...@apache.org> Committed: Mon Jun 5 16:46:30 2017 -0700 ---------------------------------------------------------------------- java/vector/src/main/codegen/data/ValueVectorTypes.tdd | 2 +- .../src/main/codegen/templates/NullableValueVectors.java | 6 +----- .../test/java/org/apache/arrow/vector/TestDecimalVector.java | 3 +++ 3 files changed, 5 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/arrow/blob/4e134e5b/java/vector/src/main/codegen/data/ValueVectorTypes.tdd ---------------------------------------------------------------------- diff --git a/java/vector/src/main/codegen/data/ValueVectorTypes.tdd b/java/vector/src/main/codegen/data/ValueVectorTypes.tdd index 970d887..b147c9e 100644 --- a/java/vector/src/main/codegen/data/ValueVectorTypes.tdd +++ b/java/vector/src/main/codegen/data/ValueVectorTypes.tdd @@ -116,7 +116,7 @@ { class: "Decimal", maxPrecisionDigits: 38, nDecimalDigits: 4, friendlyType: "BigDecimal", - typeParams: [ {name: "scale", type: "int"}, { name: "precision", type: "int"}], + typeParams: [ {name: "precision", type: "int"}, { name: "scale", type: "int"}], arrowType: "org.apache.arrow.vector.types.pojo.ArrowType.Decimal", fields: [{name: "start", type: "int"}, {name: "buffer", type: "ArrowBuf"}] } http://git-wip-us.apache.org/repos/asf/arrow/blob/4e134e5b/java/vector/src/main/codegen/templates/NullableValueVectors.java ---------------------------------------------------------------------- diff --git a/java/vector/src/main/codegen/templates/NullableValueVectors.java b/java/vector/src/main/codegen/templates/NullableValueVectors.java index a577d20..36f8338 100644 --- a/java/vector/src/main/codegen/templates/NullableValueVectors.java +++ b/java/vector/src/main/codegen/templates/NullableValueVectors.java @@ -593,7 +593,6 @@ public final class ${className} extends BaseDataValueVector implements <#if type values.getMutator().set(index, holder); } - public void set(int index, Nullable${minor.class}Holder holder){ final ${valuesName}.Mutator valuesMutator = values.getMutator(); <#if type.major == "VarLen"> @@ -666,11 +665,8 @@ public final class ${className} extends BaseDataValueVector implements <#if type <#if type.major == "VarLen">lastSet = index;</#if> } - <#if !(type.major == "VarLen" || minor.class == "IntervalYear" || minor.class == "IntervalDay")> + <#if !(type.major == "VarLen" || minor.class == "IntervalDay")> public void setSafe(int index, ${minor.javaType!type.javaType} value) { - <#if type.major == "VarLen"> - fillEmpties(index); - </#if> bits.getMutator().setSafeToOne(index); values.getMutator().setSafe(index, value); setCount++; http://git-wip-us.apache.org/repos/asf/arrow/blob/4e134e5b/java/vector/src/test/java/org/apache/arrow/vector/TestDecimalVector.java ---------------------------------------------------------------------- diff --git a/java/vector/src/test/java/org/apache/arrow/vector/TestDecimalVector.java b/java/vector/src/test/java/org/apache/arrow/vector/TestDecimalVector.java index ee7530c..b98c24d 100644 --- a/java/vector/src/test/java/org/apache/arrow/vector/TestDecimalVector.java +++ b/java/vector/src/test/java/org/apache/arrow/vector/TestDecimalVector.java @@ -45,6 +45,9 @@ public class TestDecimalVector { public void test() { BufferAllocator allocator = new RootAllocator(Integer.MAX_VALUE); NullableDecimalVector decimalVector = TestUtils.newVector(NullableDecimalVector.class, "decimal", new ArrowType.Decimal(10, scale), allocator); + try (NullableDecimalVector oldConstructor = new NullableDecimalVector("decimal", allocator, 10, scale);) { + assertEquals(decimalVector.getField().getType(), oldConstructor.getField().getType()); + } decimalVector.allocateNew(); BigDecimal[] values = new BigDecimal[intValues.length]; for (int i = 0; i < intValues.length; i++) {