arrow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [4/4] arrow git commit: ARROW-17: set some vector fields to package level access for Drill compatibility
Date Wed, 09 Mar 2016 00:26:53 GMT
ARROW-17: set some vector fields to package level access for Drill compatibility


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

Branch: refs/heads/master
Commit: 1650026285bea52288c7f24720c3caf7cd3ce2a8
Parents: 45cd9fd
Author: Steven Phillips <steven@dremio.com>
Authored: Mon Feb 29 19:32:12 2016 -0800
Committer: Steven Phillips <steven@dremio.com>
Committed: Tue Mar 8 16:09:19 2016 -0800

----------------------------------------------------------------------
 .../main/codegen/templates/BasicTypeHelper.java |  1 +
 .../codegen/templates/NullableValueVectors.java |  6 ++-
 .../codegen/templates/RepeatedValueVectors.java |  2 +-
 .../src/main/codegen/templates/UnionVector.java |  4 +-
 .../templates/VariableLengthVectors.java        |  2 +-
 .../java/org/apache/arrow/vector/BitVector.java |  4 +-
 .../apache/arrow/vector/complex/ListVector.java |  4 +-
 .../apache/arrow/vector/complex/MapVector.java  |  2 +-
 .../vector/complex/RepeatedListVector.java      |  3 +-
 .../arrow/vector/complex/RepeatedMapVector.java |  2 +-
 .../org/apache/arrow/vector/types/Types.java    | 54 ++++++++++++++++----
 11 files changed, 60 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/java/vector/src/main/codegen/templates/BasicTypeHelper.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/BasicTypeHelper.java b/java/vector/src/main/codegen/templates/BasicTypeHelper.java
index bb6446e..0bae715 100644
--- a/java/vector/src/main/codegen/templates/BasicTypeHelper.java
+++ b/java/vector/src/main/codegen/templates/BasicTypeHelper.java
@@ -231,6 +231,7 @@ public class BasicTypeHelper {
     return getNewVector(field, allocator, null);
   }
   public static ValueVector getNewVector(MaterializedField field, BufferAllocator allocator,
CallBack callBack){
+    field = field.clone();
     MajorType type = field.getType();
 
     switch (type.getMinorType()) {

http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/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 6893a25..b0029f7 100644
--- a/java/vector/src/main/codegen/templates/NullableValueVectors.java
+++ b/java/vector/src/main/codegen/templates/NullableValueVectors.java
@@ -45,8 +45,10 @@ public final class ${className} extends BaseDataValueVector implements
<#if type
   private final FieldReader reader = new Nullable${minor.class}ReaderImpl(Nullable${minor.class}Vector.this);
 
   private final MaterializedField bitsField = MaterializedField.create("$bits$", new MajorType(MinorType.UINT1,
DataMode.REQUIRED));
-  private final UInt1Vector bits = new UInt1Vector(bitsField, allocator);
-  private final ${valuesName} values = new ${minor.class}Vector(field, allocator);
+  private final MaterializedField valuesField = MaterializedField.create("$values$", new
MajorType(field.getType().getMinorType(), DataMode.REQUIRED, field.getPrecision(), field.getScale()));
+
+  final UInt1Vector bits = new UInt1Vector(bitsField, allocator);
+  final ${valuesName} values = new ${minor.class}Vector(valuesField, allocator);
 
   private final Mutator mutator = new Mutator();
   private final Accessor accessor = new Accessor();

http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/java/vector/src/main/codegen/templates/RepeatedValueVectors.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/RepeatedValueVectors.java b/java/vector/src/main/codegen/templates/RepeatedValueVectors.java
index 5ac80f5..ceae53b 100644
--- a/java/vector/src/main/codegen/templates/RepeatedValueVectors.java
+++ b/java/vector/src/main/codegen/templates/RepeatedValueVectors.java
@@ -42,7 +42,7 @@ public final class Repeated${minor.class}Vector extends BaseRepeatedValueVector
   //private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Repeated${minor.class}Vector.class);
 
   // we maintain local reference to concrete vector type for performance reasons.
-  private ${minor.class}Vector values;
+  ${minor.class}Vector values;
   private final FieldReader reader = new Repeated${minor.class}ReaderImpl(Repeated${minor.class}Vector.this);
   private final Mutator mutator = new Mutator();
   private final Accessor accessor = new Accessor();

http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/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 ba94ac2..6042a5b 100644
--- a/java/vector/src/main/codegen/templates/UnionVector.java
+++ b/java/vector/src/main/codegen/templates/UnionVector.java
@@ -51,9 +51,9 @@ public class UnionVector implements ValueVector {
   private BufferAllocator allocator;
   private Accessor accessor = new Accessor();
   private Mutator mutator = new Mutator();
-  private int valueCount;
+  int valueCount;
 
-  private MapVector internalMap;
+  MapVector internalMap;
   private UInt1Vector typeVector;
 
   private MapVector mapVector;

http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/java/vector/src/main/codegen/templates/VariableLengthVectors.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/codegen/templates/VariableLengthVectors.java b/java/vector/src/main/codegen/templates/VariableLengthVectors.java
index 13d53b8..84fb3eb 100644
--- a/java/vector/src/main/codegen/templates/VariableLengthVectors.java
+++ b/java/vector/src/main/codegen/templates/VariableLengthVectors.java
@@ -57,7 +57,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements
V
 
   public final static String OFFSETS_VECTOR_NAME = "$offsets$";
   private final MaterializedField offsetsField = MaterializedField.create(OFFSETS_VECTOR_NAME,
new MajorType(MinorType.UINT4, DataMode.REQUIRED));
-  private final UInt${type.width}Vector offsetVector = new UInt${type.width}Vector(offsetsField,
allocator);
+  final UInt${type.width}Vector offsetVector = new UInt${type.width}Vector(offsetsField,
allocator);
   private final FieldReader reader = new ${minor.class}ReaderImpl(${minor.class}Vector.this);
 
   private final Accessor accessor;

http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/java/vector/src/main/java/org/apache/arrow/vector/BitVector.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/BitVector.java b/java/vector/src/main/java/org/apache/arrow/vector/BitVector.java
index 952e902..c5bcb2d 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/BitVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/BitVector.java
@@ -41,7 +41,7 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe
   private final Accessor accessor = new Accessor();
   private final Mutator mutator = new Mutator();
 
-  private int valueCount;
+  int valueCount;
   private int allocationSizeInBytes = INITIAL_VALUE_ALLOCATION;
   private int allocationMonitor = 0;
 
@@ -64,7 +64,7 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe
     return getSizeFromCount(valueCount);
   }
 
-  private int getSizeFromCount(int valueCount) {
+  int getSizeFromCount(int valueCount) {
     return (int) Math.ceil(valueCount / 8.0);
   }
 

http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/java/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java
index 8387c9e..13610c4 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java
@@ -47,8 +47,8 @@ import com.google.common.collect.ObjectArrays;
 
 public class ListVector extends BaseRepeatedValueVector {
 
-  private UInt4Vector offsets;
-  private final UInt1Vector bits;
+  UInt4Vector offsets;
+  final UInt1Vector bits;
   private Mutator mutator = new Mutator();
   private Accessor accessor = new Accessor();
   private UnionListWriter writer;

http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java b/java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java
index 1bbce73..cc0953a 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java
@@ -52,7 +52,7 @@ public class MapVector extends AbstractMapVector {
   private final SingleMapReaderImpl reader = new SingleMapReaderImpl(MapVector.this);
   private final Accessor accessor = new Accessor();
   private final Mutator mutator = new Mutator();
-  private int valueCount;
+  int valueCount;
 
   public MapVector(String path, BufferAllocator allocator, CallBack callBack){
     this(MaterializedField.create(path, TYPE), allocator, callBack);

http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedListVector.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedListVector.java
b/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedListVector.java
index 778fe81..f337f9c 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedListVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedListVector.java
@@ -49,7 +49,7 @@ public class RepeatedListVector extends AbstractContainerVector
 
   public final static MajorType TYPE = new MajorType(MinorType.LIST, DataMode.REPEATED);
   private final RepeatedListReaderImpl reader = new RepeatedListReaderImpl(null, this);
-  private final DelegateRepeatedVector delegate;
+  final DelegateRepeatedVector delegate;
 
   protected static class DelegateRepeatedVector extends BaseRepeatedValueVector {
 
@@ -313,7 +313,6 @@ public class RepeatedListVector extends AbstractContainerVector
     if (result.isCreated() && callBack != null) {
       callBack.doWork();
     }
-    this.field = delegate.getField();
     return result;
   }
 

http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedMapVector.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedMapVector.java
b/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedMapVector.java
index e7eacd3..686414e 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedMapVector.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedMapVector.java
@@ -53,7 +53,7 @@ public class RepeatedMapVector extends AbstractMapVector
 
   public final static MajorType TYPE = new MajorType(MinorType.MAP, DataMode.REPEATED);
 
-  private final UInt4Vector offsets;   // offsets to start of each record (considering record
indices are 0-indexed)
+  final UInt4Vector offsets;   // offsets to start of each record (considering record indices
are 0-indexed)
   private final RepeatedMapReaderImpl reader = new RepeatedMapReaderImpl(RepeatedMapVector.this);
   private final RepeatedMapAccessor accessor = new RepeatedMapAccessor();
   private final Mutator mutator = new Mutator();

http://git-wip-us.apache.org/repos/asf/arrow/blob/16500262/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
----------------------------------------------------------------------
diff --git a/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java b/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
index cef892c..88999cb 100644
--- a/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
+++ b/java/vector/src/main/java/org/apache/arrow/vector/types/Types.java
@@ -20,6 +20,7 @@ package org.apache.arrow.vector.types;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.Objects;
 
 public class Types {
   public enum MinorType {
@@ -73,26 +74,35 @@ public class Types {
   public static class MajorType {
     private MinorType minorType;
     private DataMode mode;
-    private Integer precision;
-    private Integer scale;
-    private Integer timezone;
+    private int precision;
+    private int scale;
+    private int timezone;
+    private int width;
     private List<MinorType> subTypes;
 
     public MajorType(MinorType minorType, DataMode mode) {
-      this(minorType, mode, null, null, null, null);
+      this(minorType, mode, 0, 0, 0, 0, null);
     }
 
-    public MajorType(MinorType minorType, DataMode mode, Integer precision, Integer scale)
{
-      this(minorType, mode, precision, scale, null, null);
+    public MajorType(MinorType minorType, DataMode mode, int precision, int scale) {
+      this(minorType, mode, precision, scale, 0, 0, null);
     }
 
-    public MajorType(MinorType minorType, DataMode mode, Integer precision, Integer scale,
Integer timezone, List<MinorType> subTypes) {
+    public MajorType(MinorType minorType, DataMode mode, int precision, int scale, int timezone,
List<MinorType> subTypes) {
+      this(minorType, mode, precision, scale, timezone, 0, subTypes);
+    }
+
+    public MajorType(MinorType minorType, DataMode mode, int precision, int scale, int timezone,
int width, List<MinorType> subTypes) {
       this.minorType = minorType;
       this.mode = mode;
       this.precision = precision;
       this.scale = scale;
       this.timezone = timezone;
+      this.width = width;
       this.subTypes = subTypes;
+      if (subTypes == null) {
+        this.subTypes = new ArrayList<>();
+      }
     }
 
     public MinorType getMinorType() {
@@ -103,21 +113,45 @@ public class Types {
       return mode;
     }
 
-    public Integer getPrecision() {
+    public int getPrecision() {
       return precision;
     }
 
-    public Integer getScale() {
+    public int getScale() {
       return scale;
     }
 
-    public Integer getTimezone() {
+    public int getTimezone() {
       return timezone;
     }
 
     public List<MinorType> getSubTypes() {
       return subTypes;
     }
+
+    public int getWidth() {
+      return width;
+    }
+
+
+    @Override
+    public boolean equals(Object other) {
+      if (other == null) {
+        return false;
+      }
+      if (!(other instanceof MajorType)) {
+        return false;
+      }
+      MajorType that = (MajorType) other;
+      return this.minorType == that.minorType &&
+              this.mode == that.mode &&
+              this.precision == that.precision &&
+              this.scale == that.scale &&
+              this.timezone == that.timezone &&
+              this.width == that.width &&
+              Objects.equals(this.subTypes, that.subTypes);
+    }
+
   }
 
   public static MajorType required(MinorType minorType) {


Mime
View raw message