Skip to content

Commit b76caf4

Browse files
liyafan82emkornfield
authored andcommitted
ARROW-13544 [Java]: Remove APIs that have been deprecated for long (Changes to Vectors)
See https://issues.apache.org/jira/browse/ARROW-13544 According to the discussion in apache#10864 (comment), we want to split the task into multiple parts. This PR is for the changes related to vectors Closes apache#10910 from liyafan82/fly_0810_depv Authored-by: liyafan82 <fan_li_ya@foxmail.com> Signed-off-by: Micah Kornfield <emkornfield@gmail.com>
1 parent 69972dd commit b76caf4

19 files changed

Lines changed: 55 additions & 233 deletions

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,6 @@ public static UnionVector empty(String name, BufferAllocator allocator) {
114114
return new UnionVector(name, allocator, fieldType, null);
115115
}
116116

117-
@Deprecated
118-
public UnionVector(String name, BufferAllocator allocator, CallBack callBack) {
119-
this(name, allocator, null, callBack);
120-
}
121-
122117
public UnionVector(String name, BufferAllocator allocator, FieldType fieldType, CallBack callBack) {
123118
super(name, allocator, callBack);
124119
this.fieldType = fieldType;
@@ -522,7 +517,7 @@ private class TransferImpl implements TransferPair {
522517
private final UnionVector to;
523518
524519
public TransferImpl(String name, BufferAllocator allocator, CallBack callBack) {
525-
to = new UnionVector(name, allocator, callBack);
520+
to = new UnionVector(name, allocator, /* field type */ null, callBack);
526521
internalStructVectorTransferPair = internalStruct.makeTransferPair(to.internalStruct);
527522
}
528523

‎java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,17 +1215,6 @@ protected final void setBytes(int index, byte[] value, int start, int length) {
12151215
valueBuffer.setBytes(startOffset, value, start, length);
12161216
}
12171217

1218-
/**
1219-
* Gets the starting offset of a record, given its index.
1220-
* This method is deprecated. Please use {@link BaseVariableWidthVector#getStartOffset(int)} instead.
1221-
* @param index index of the record.
1222-
* @return the starting offset of the record.
1223-
*/
1224-
@Deprecated
1225-
protected final int getstartOffset(int index) {
1226-
return getStartOffset(index);
1227-
}
1228-
12291218
public final int getStartOffset(int index) {
12301219
return offsetBuffer.getInt((long) index * OFFSET_WIDTH);
12311220
}

‎java/vector/src/main/java/org/apache/arrow/vector/BitVectorHelper.java‎

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,16 +88,6 @@ public static void setBit(ArrowBuf validityBuffer, long index) {
8888
validityBuffer.setByte(byteIndex, currentByte);
8989
}
9090

91-
/**
92-
* Set the bit at provided index to 1.
93-
*
94-
* @deprecated Please use {@link BitVectorHelper#setBit(ArrowBuf, long)} instead..
95-
*/
96-
@Deprecated
97-
public static void setValidityBitToOne(ArrowBuf validityBuffer, int index) {
98-
setBit(validityBuffer, index);
99-
}
100-
10191
/**
10292
* Set the bit at provided index to 0.
10393
*

‎java/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import org.apache.arrow.vector.ipc.message.ArrowFieldNode;
5151
import org.apache.arrow.vector.types.Types.MinorType;
5252
import org.apache.arrow.vector.types.pojo.ArrowType;
53-
import org.apache.arrow.vector.types.pojo.DictionaryEncoding;
5453
import org.apache.arrow.vector.types.pojo.Field;
5554
import org.apache.arrow.vector.types.pojo.FieldType;
5655
import org.apache.arrow.vector.util.CallBack;
@@ -77,20 +76,6 @@ public static FixedSizeListVector empty(String name, int size, BufferAllocator a
7776
private int valueCount;
7877
private int validityAllocationSizeInBytes;
7978

80-
/**
81-
* Creates a new instance.
82-
*
83-
* @deprecated use FieldType or static constructor instead.
84-
*/
85-
@Deprecated
86-
public FixedSizeListVector(String name,
87-
BufferAllocator allocator,
88-
int listSize,
89-
DictionaryEncoding dictionary,
90-
CallBack schemaChangeCallback) {
91-
this(name, allocator, new FieldType(true, new ArrowType.FixedSizeList(listSize), dictionary), schemaChangeCallback);
92-
}
93-
9479
/**
9580
* Creates a new instance.
9681
*
@@ -407,7 +392,7 @@ public void copyFrom(int fromIndex, int thisIndex, ValueVector from) {
407392

408393
@Override
409394
public UnionVector promoteToUnion() {
410-
UnionVector vector = new UnionVector(name, allocator, null);
395+
UnionVector vector = new UnionVector(name, allocator, /* field type */ null, /* call-back */ null);
411396
this.vector.clear();
412397
this.vector = vector;
413398
invalidateReader();

‎java/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ protected void replaceDataVector(FieldVector v) {
541541

542542
@Override
543543
public UnionVector promoteToUnion() {
544-
UnionVector vector = new UnionVector("$data$", allocator, callBack);
544+
UnionVector vector = new UnionVector("$data$", allocator, /* field type */ null, callBack);
545545
replaceDataVector(vector);
546546
invalidateReader();
547547
if (callBack != null) {

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

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import org.apache.arrow.vector.ipc.message.ArrowFieldNode;
5151
import org.apache.arrow.vector.types.Types.MinorType;
5252
import org.apache.arrow.vector.types.pojo.ArrowType;
53-
import org.apache.arrow.vector.types.pojo.DictionaryEncoding;
5453
import org.apache.arrow.vector.types.pojo.Field;
5554
import org.apache.arrow.vector.types.pojo.FieldType;
5655
import org.apache.arrow.vector.util.CallBack;
@@ -84,26 +83,6 @@ public static ListVector empty(String name, BufferAllocator allocator) {
8483
*/
8584
private int lastSet;
8685

87-
/**
88-
* Creates a ListVector.
89-
*
90-
* @deprecated Use FieldType or static constructor instead.
91-
*/
92-
@Deprecated
93-
public ListVector(String name, BufferAllocator allocator, CallBack callBack) {
94-
this(name, allocator, FieldType.nullable(ArrowType.List.INSTANCE), callBack);
95-
}
96-
97-
/**
98-
* Creates a ListVector.
99-
*
100-
* @deprecated Use FieldType or static constructor instead.
101-
*/
102-
@Deprecated
103-
public ListVector(String name, BufferAllocator allocator, DictionaryEncoding dictionary, CallBack callBack) {
104-
this(name, allocator, new FieldType(true, ArrowType.List.INSTANCE, dictionary, null), callBack);
105-
}
106-
10786
/**
10887
* Constructs a new instance.
10988
*
@@ -680,7 +659,7 @@ public ArrowBuf[] getBuffers(boolean clear) {
680659

681660
@Override
682661
public UnionVector promoteToUnion() {
683-
UnionVector vector = new UnionVector("$data$", allocator, callBack);
662+
UnionVector vector = new UnionVector("$data$", allocator, /* field type*/ null, callBack);
684663
replaceDataVector(vector);
685664
invalidateReader();
686665
if (callBack != null) {

‎java/vector/src/main/java/org/apache/arrow/vector/types/pojo/Field.java‎

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -94,26 +94,6 @@ private Field(String name, FieldType fieldType, List<Field> children, TypeLayout
9494
this.children = children == null ? Collections.emptyList() : children.stream().collect(Collectors.toList());
9595
}
9696

97-
/**
98-
* Creates a new field.
99-
*
100-
* @deprecated Use FieldType or static constructor instead.
101-
*/
102-
@Deprecated
103-
public Field(String name, boolean nullable, ArrowType type, List<Field> children) {
104-
this(name, new FieldType(nullable, type, null, null), children);
105-
}
106-
107-
/**
108-
* Creates a new field.
109-
*
110-
* @deprecated Use FieldType or static constructor instead.
111-
*/
112-
@Deprecated
113-
public Field(String name, boolean nullable, ArrowType type, DictionaryEncoding dictionary, List<Field> children) {
114-
this(name, new FieldType(nullable, type, dictionary, null), children);
115-
}
116-
11797
public Field(String name, FieldType fieldType, List<Field> children) {
11898
this(name, fieldType, children, fieldType == null ? null : TypeLayout.getTypeLayout(fieldType.getType()));
11999
}

‎java/vector/src/main/java/org/apache/arrow/vector/util/ByteFunctionHelpers.java‎

Lines changed: 0 additions & 112 deletions
This file was deleted.

‎java/vector/src/test/java/org/apache/arrow/vector/TestBitVectorHelper.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ public void testConcatBits() {
164164
final int maxCount = 100;
165165
for (int i = 0; i < maxCount; i++) {
166166
if (i % 3 == 0) {
167-
BitVectorHelper.setValidityBitToOne(buf1, i);
168-
BitVectorHelper.setValidityBitToOne(buf2, i);
167+
BitVectorHelper.setBit(buf1, i);
168+
BitVectorHelper.setBit(buf2, i);
169169
}
170170
}
171171

@@ -199,8 +199,8 @@ public void testConcatBitsInPlace() {
199199
final int maxCount = 100;
200200
for (int i = 0; i < maxCount; i++) {
201201
if (i % 3 == 0) {
202-
BitVectorHelper.setValidityBitToOne(buf1, i);
203-
BitVectorHelper.setValidityBitToOne(buf2, i);
202+
BitVectorHelper.setBit(buf1, i);
203+
BitVectorHelper.setBit(buf2, i);
204204
}
205205
}
206206

‎java/vector/src/test/java/org/apache/arrow/vector/TestDictionaryVector.java‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,9 @@ public void testEncodeBinaryVector() {
306306
@Test
307307
public void testEncodeUnion() {
308308
// Create a new value vector
309-
try (final UnionVector vector = new UnionVector("vector", allocator, null);
310-
final UnionVector dictionaryVector = new UnionVector("dict", allocator, null);) {
309+
try (final UnionVector vector = new UnionVector("vector", allocator, /* field type */ null, /* call-back */ null);
310+
final UnionVector dictionaryVector =
311+
new UnionVector("dict", allocator, /* field type */ null, /* call-back */ null);) {
311312

312313
final NullableUInt4Holder uintHolder1 = new NullableUInt4Holder();
313314
uintHolder1.value = 10;
@@ -494,8 +495,9 @@ public void testStructEquals() {
494495

495496
@Test
496497
public void testUnionEquals() {
497-
try (final UnionVector vector1 = new UnionVector("union", allocator, null);
498-
final UnionVector vector2 = new UnionVector("union", allocator, null);) {
498+
try (final UnionVector vector1 = new UnionVector("union", allocator, /* field type */ null, /* call-back */ null);
499+
final UnionVector vector2 =
500+
new UnionVector("union", allocator, /* field type */ null, /* call-back */ null);) {
499501

500502
final NullableUInt4Holder uInt4Holder = new NullableUInt4Holder();
501503
uInt4Holder.value = 10;

0 commit comments

Comments
 (0)