Skip to content

Commit 1650026

Browse files
ARROW-17: set some vector fields to package level access for Drill compatibility
1 parent 45cd9fd commit 1650026

11 files changed

Lines changed: 60 additions & 24 deletions

File tree

java/vector/src/main/codegen/templates/BasicTypeHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ public static ValueVector getNewVector(MaterializedField field, BufferAllocator
231231
return getNewVector(field, allocator, null);
232232
}
233233
public static ValueVector getNewVector(MaterializedField field, BufferAllocator allocator, CallBack callBack){
234+
field = field.clone();
234235
MajorType type = field.getType();
235236
236237
switch (type.getMinorType()) {

java/vector/src/main/codegen/templates/NullableValueVectors.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ public final class ${className} extends BaseDataValueVector implements <#if type
4545
private final FieldReader reader = new Nullable${minor.class}ReaderImpl(Nullable${minor.class}Vector.this);
4646

4747
private final MaterializedField bitsField = MaterializedField.create("$bits$", new MajorType(MinorType.UINT1, DataMode.REQUIRED));
48-
private final UInt1Vector bits = new UInt1Vector(bitsField, allocator);
49-
private final ${valuesName} values = new ${minor.class}Vector(field, allocator);
48+
private final MaterializedField valuesField = MaterializedField.create("$values$", new MajorType(field.getType().getMinorType(), DataMode.REQUIRED, field.getPrecision(), field.getScale()));
49+
50+
final UInt1Vector bits = new UInt1Vector(bitsField, allocator);
51+
final ${valuesName} values = new ${minor.class}Vector(valuesField, allocator);
5052

5153
private final Mutator mutator = new Mutator();
5254
private final Accessor accessor = new Accessor();

java/vector/src/main/codegen/templates/RepeatedValueVectors.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public final class Repeated${minor.class}Vector extends BaseRepeatedValueVector
4242
//private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(Repeated${minor.class}Vector.class);
4343

4444
// we maintain local reference to concrete vector type for performance reasons.
45-
private ${minor.class}Vector values;
45+
${minor.class}Vector values;
4646
private final FieldReader reader = new Repeated${minor.class}ReaderImpl(Repeated${minor.class}Vector.this);
4747
private final Mutator mutator = new Mutator();
4848
private final Accessor accessor = new Accessor();

java/vector/src/main/codegen/templates/UnionVector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ public class UnionVector implements ValueVector {
5151
private BufferAllocator allocator;
5252
private Accessor accessor = new Accessor();
5353
private Mutator mutator = new Mutator();
54-
private int valueCount;
54+
int valueCount;
5555

56-
private MapVector internalMap;
56+
MapVector internalMap;
5757
private UInt1Vector typeVector;
5858

5959
private MapVector mapVector;

java/vector/src/main/codegen/templates/VariableLengthVectors.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public final class ${minor.class}Vector extends BaseDataValueVector implements V
5757
5858
public final static String OFFSETS_VECTOR_NAME = "$offsets$";
5959
private final MaterializedField offsetsField = MaterializedField.create(OFFSETS_VECTOR_NAME, new MajorType(MinorType.UINT4, DataMode.REQUIRED));
60-
private final UInt${type.width}Vector offsetVector = new UInt${type.width}Vector(offsetsField, allocator);
60+
final UInt${type.width}Vector offsetVector = new UInt${type.width}Vector(offsetsField, allocator);
6161
private final FieldReader reader = new ${minor.class}ReaderImpl(${minor.class}Vector.this);
6262
6363
private final Accessor accessor;

java/vector/src/main/java/org/apache/arrow/vector/BitVector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public final class BitVector extends BaseDataValueVector implements FixedWidthVe
4141
private final Accessor accessor = new Accessor();
4242
private final Mutator mutator = new Mutator();
4343

44-
private int valueCount;
44+
int valueCount;
4545
private int allocationSizeInBytes = INITIAL_VALUE_ALLOCATION;
4646
private int allocationMonitor = 0;
4747

@@ -64,7 +64,7 @@ public int getBufferSizeFor(final int valueCount) {
6464
return getSizeFromCount(valueCount);
6565
}
6666

67-
private int getSizeFromCount(int valueCount) {
67+
int getSizeFromCount(int valueCount) {
6868
return (int) Math.ceil(valueCount / 8.0);
6969
}
7070

java/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747

4848
public class ListVector extends BaseRepeatedValueVector {
4949

50-
private UInt4Vector offsets;
51-
private final UInt1Vector bits;
50+
UInt4Vector offsets;
51+
final UInt1Vector bits;
5252
private Mutator mutator = new Mutator();
5353
private Accessor accessor = new Accessor();
5454
private UnionListWriter writer;

java/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public class MapVector extends AbstractMapVector {
5252
private final SingleMapReaderImpl reader = new SingleMapReaderImpl(MapVector.this);
5353
private final Accessor accessor = new Accessor();
5454
private final Mutator mutator = new Mutator();
55-
private int valueCount;
55+
int valueCount;
5656

5757
public MapVector(String path, BufferAllocator allocator, CallBack callBack){
5858
this(MaterializedField.create(path, TYPE), allocator, callBack);

java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedListVector.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public class RepeatedListVector extends AbstractContainerVector
4949

5050
public final static MajorType TYPE = new MajorType(MinorType.LIST, DataMode.REPEATED);
5151
private final RepeatedListReaderImpl reader = new RepeatedListReaderImpl(null, this);
52-
private final DelegateRepeatedVector delegate;
52+
final DelegateRepeatedVector delegate;
5353

5454
protected static class DelegateRepeatedVector extends BaseRepeatedValueVector {
5555

@@ -313,7 +313,6 @@ public <T extends ValueVector> AddOrGetResult<T> addOrGetVector(VectorDescriptor
313313
if (result.isCreated() && callBack != null) {
314314
callBack.doWork();
315315
}
316-
this.field = delegate.getField();
317316
return result;
318317
}
319318

java/vector/src/main/java/org/apache/arrow/vector/complex/RepeatedMapVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public class RepeatedMapVector extends AbstractMapVector
5353

5454
public final static MajorType TYPE = new MajorType(MinorType.MAP, DataMode.REPEATED);
5555

56-
private final UInt4Vector offsets; // offsets to start of each record (considering record indices are 0-indexed)
56+
final UInt4Vector offsets; // offsets to start of each record (considering record indices are 0-indexed)
5757
private final RepeatedMapReaderImpl reader = new RepeatedMapReaderImpl(RepeatedMapVector.this);
5858
private final RepeatedMapAccessor accessor = new RepeatedMapAccessor();
5959
private final Mutator mutator = new Mutator();

0 commit comments

Comments
 (0)