From c4658ae8134b4a32896c667619d2e4e9e82d589d Mon Sep 17 00:00:00 2001 From: jhrotko Date: Wed, 22 Oct 2025 21:09:52 +0100 Subject: [PATCH 01/12] GH-891: Add ExtensionTypeWriterFactory to TransferPair --- .../main/codegen/templates/ComplexCopier.java | 9 +- .../arrow/vector/complex/LargeListVector.java | 9 +- .../arrow/vector/complex/ListVector.java | 9 +- .../util/TransferPairWithExtendedType.java | 23 +++++ .../arrow/vector/TestLargeListVector.java | 85 +++++++++++++++++++ .../apache/arrow/vector/TestListVector.java | 78 +++++++++++++++++ 6 files changed, 210 insertions(+), 3 deletions(-) create mode 100644 vector/src/main/java/org/apache/arrow/vector/util/TransferPairWithExtendedType.java diff --git a/vector/src/main/codegen/templates/ComplexCopier.java b/vector/src/main/codegen/templates/ComplexCopier.java index 4df5478f48..e9c4d4d6b9 100644 --- a/vector/src/main/codegen/templates/ComplexCopier.java +++ b/vector/src/main/codegen/templates/ComplexCopier.java @@ -63,7 +63,7 @@ private static void writeValue(FieldReader reader, FieldWriter writer, Extension writer.startList(); while (reader.next()) { FieldReader childReader = reader.reader(); - FieldWriter childWriter = getListWriterForReader(childReader, writer); + FieldWriter childWriter = getListWriterForReader(childReader, writer, extensionTypeWriterFactory); if (childReader.isSet()) { writeValue(childReader, childWriter, extensionTypeWriterFactory); } else { @@ -189,6 +189,10 @@ private static FieldWriter getStructWriterForReader(FieldReader reader, StructWr } private static FieldWriter getListWriterForReader(FieldReader reader, ListWriter writer) { + return getListWriterForReader(reader, writer, null); + } + + private static FieldWriter getListWriterForReader(FieldReader reader, ListWriter writer, ExtensionTypeWriterFactory extensionTypeWriterFactory) { switch (reader.getMinorType()) { <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first /> <#assign fields = minor.fields!type.fields /> @@ -209,6 +213,9 @@ private static FieldWriter getListWriterForReader(FieldReader reader, ListWriter return (FieldWriter) writer.listView(); case EXTENSIONTYPE: ExtensionWriter extensionWriter = writer.extension(reader.getField().getType()); + if (extensionTypeWriterFactory != null) { + extensionWriter.addExtensionTypeWriterFactory(extensionTypeWriterFactory); + } return (FieldWriter) extensionWriter; default: throw new UnsupportedOperationException(reader.getMinorType().toString()); diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java index 48c8127e23..1b9e97e1cc 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java @@ -63,6 +63,7 @@ import org.apache.arrow.vector.util.OversizedAllocationException; import org.apache.arrow.vector.util.SchemaChangeRuntimeException; import org.apache.arrow.vector.util.TransferPair; +import org.apache.arrow.vector.util.TransferPairWithExtendedType; /** * A list vector contains lists of a specific type of elements. Its structure contains 3 elements. @@ -648,7 +649,7 @@ public UnionVector promoteToUnion() { return vector; } - private class TransferImpl implements TransferPair { + private class TransferImpl implements TransferPairWithExtendedType { LargeListVector to; TransferPair dataTransferPair; @@ -731,6 +732,12 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, LargeListVector.this); } + + @Override + public void copyValueSafe( + int from, int to, ExtensionTypeWriterFactory extensionTypeWriterFactory) { + this.to.copyFrom(from, to, LargeListVector.this, extensionTypeWriterFactory); + } } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java index 89549257c4..4bd7125ff5 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java @@ -56,6 +56,7 @@ import org.apache.arrow.vector.util.JsonStringArrayList; import org.apache.arrow.vector.util.OversizedAllocationException; import org.apache.arrow.vector.util.TransferPair; +import org.apache.arrow.vector.util.TransferPairWithExtendedType; /** * A list vector contains lists of a specific type of elements. Its structure contains 3 elements. @@ -528,7 +529,7 @@ public OUT accept(VectorVisitor visitor, IN value) { return visitor.visit(this, value); } - private class TransferImpl implements TransferPair { + private class TransferImpl implements TransferPairWithExtendedType { ListVector to; TransferPair dataTransferPair; @@ -612,6 +613,12 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, ListVector.this); } + + @Override + public void copyValueSafe( + int from, int to, ExtensionTypeWriterFactory extensionTypeWriterFactory) { + this.to.copyFrom(from, to, ListVector.this, extensionTypeWriterFactory); + } } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/util/TransferPairWithExtendedType.java b/vector/src/main/java/org/apache/arrow/vector/util/TransferPairWithExtendedType.java new file mode 100644 index 0000000000..848e983bad --- /dev/null +++ b/vector/src/main/java/org/apache/arrow/vector/util/TransferPairWithExtendedType.java @@ -0,0 +1,23 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.arrow.vector.util; + +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; + +public interface TransferPairWithExtendedType extends TransferPair { + void copyValueSafe(int from, int to, ExtensionTypeWriterFactory extensionTypeWriterFactory); +} diff --git a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java index d5cbf925b2..f94a362e67 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java @@ -23,20 +23,27 @@ import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; +import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.UUID; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.vector.complex.BaseRepeatedValueVector; import org.apache.arrow.vector.complex.LargeListVector; import org.apache.arrow.vector.complex.ListVector; +import org.apache.arrow.vector.complex.impl.UnionLargeListReader; import org.apache.arrow.vector.complex.impl.UnionLargeListWriter; +import org.apache.arrow.vector.complex.impl.UuidWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; +import org.apache.arrow.vector.complex.writer.BaseWriter.ExtensionWriter; +import org.apache.arrow.vector.holder.UuidHolder; import org.apache.arrow.vector.types.Types.MinorType; import org.apache.arrow.vector.types.pojo.ArrowType; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.types.pojo.FieldType; +import org.apache.arrow.vector.types.pojo.UuidType; import org.apache.arrow.vector.util.TransferPair; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -1021,6 +1028,84 @@ public void testGetTransferPairWithField() throws Exception { } } + @Test + public void testCopyValueSafeForExtensionType() throws Exception { + try (LargeListVector inVector = LargeListVector.empty("input", allocator); + LargeListVector outVector = LargeListVector.empty("output", allocator)) { + UnionLargeListWriter writer = inVector.getWriter(); + writer.allocate(); + + // Create first list with UUIDs + writer.setPosition(0); + UUID u1 = UUID.randomUUID(); + UUID u2 = UUID.randomUUID(); + writer.startList(); + ExtensionWriter extensionWriter = writer.extension(new UuidType()); + extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + extensionWriter.writeExtension(u1); + extensionWriter.writeExtension(u2); + writer.endList(); + + // Create second list with UUIDs + writer.setPosition(1); + UUID u3 = UUID.randomUUID(); + UUID u4 = UUID.randomUUID(); + writer.startList(); + extensionWriter = writer.extension(new UuidType()); + extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + extensionWriter.writeExtension(u3); + extensionWriter.writeExtension(u4); + extensionWriter.writeNull(); + + writer.endList(); + writer.setValueCount(2); + + // Use copyFromSafe with ExtensionTypeWriterFactory + // This internally calls TransferImpl.copyValueSafe with ExtensionTypeWriterFactory + outVector.allocateNew(); + outVector.copyFromSafe(0, 0, inVector, new UuidWriterFactory()); + outVector.copyFromSafe(1, 1, inVector, new UuidWriterFactory()); + outVector.setValueCount(2); + + // Verify first list + UnionLargeListReader reader = outVector.getReader(); + reader.setPosition(0); + assertTrue(reader.isSet(), "first list shouldn't be null"); + reader.next(); + FieldReader uuidReader = reader.reader(); + UuidHolder holder = new UuidHolder(); + uuidReader.read(holder); + ByteBuffer bb = ByteBuffer.wrap(holder.value); + UUID actualUuid = new UUID(bb.getLong(), bb.getLong()); + assertEquals(u1, actualUuid); + reader.next(); + uuidReader = reader.reader(); + uuidReader.read(holder); + bb = ByteBuffer.wrap(holder.value); + actualUuid = new UUID(bb.getLong(), bb.getLong()); + assertEquals(u2, actualUuid); + + // Verify second list + reader.setPosition(1); + assertTrue(reader.isSet(), "second list shouldn't be null"); + reader.next(); + uuidReader = reader.reader(); + uuidReader.read(holder); + bb = ByteBuffer.wrap(holder.value); + actualUuid = new UUID(bb.getLong(), bb.getLong()); + assertEquals(u3, actualUuid); + reader.next(); + uuidReader = reader.reader(); + uuidReader.read(holder); + bb = ByteBuffer.wrap(holder.value); + actualUuid = new UUID(bb.getLong(), bb.getLong()); + assertEquals(u4, actualUuid); + reader.next(); + uuidReader = reader.reader(); + assertFalse(uuidReader.isSet(), "third element should be null"); + } + } + private void writeIntValues(UnionLargeListWriter writer, int[] values) { writer.startList(); for (int v : values) { diff --git a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java index c6c7c5c862..b81ca61e4c 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java @@ -1314,6 +1314,84 @@ public void testCopyFromForExtensionType() throws Exception { } } + @Test + public void testCopyValueSafeForExtensionType() throws Exception { + try (ListVector inVector = ListVector.empty("input", allocator); + ListVector outVector = ListVector.empty("output", allocator)) { + UnionListWriter writer = inVector.getWriter(); + writer.allocate(); + + // Create first list with UUIDs + writer.setPosition(0); + UUID u1 = UUID.randomUUID(); + UUID u2 = UUID.randomUUID(); + writer.startList(); + ExtensionWriter extensionWriter = writer.extension(new UuidType()); + extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + extensionWriter.writeExtension(u1); + extensionWriter.writeExtension(u2); + writer.endList(); + + // Create second list with UUIDs + writer.setPosition(1); + UUID u3 = UUID.randomUUID(); + UUID u4 = UUID.randomUUID(); + writer.startList(); + extensionWriter = writer.extension(new UuidType()); + extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + extensionWriter.writeExtension(u3); + extensionWriter.writeExtension(u4); + extensionWriter.writeNull(); + + writer.endList(); + writer.setValueCount(2); + + // Use copyFromSafe with ExtensionTypeWriterFactory + // This internally calls TransferImpl.copyValueSafe with ExtensionTypeWriterFactory + outVector.allocateNew(); + outVector.copyFromSafe(0, 0, inVector, new UuidWriterFactory()); + outVector.copyFromSafe(1, 1, inVector, new UuidWriterFactory()); + outVector.setValueCount(2); + + // Verify first list + UnionListReader reader = outVector.getReader(); + reader.setPosition(0); + assertTrue(reader.isSet(), "first list shouldn't be null"); + reader.next(); + FieldReader uuidReader = reader.reader(); + UuidHolder holder = new UuidHolder(); + uuidReader.read(holder); + ByteBuffer bb = ByteBuffer.wrap(holder.value); + UUID actualUuid = new UUID(bb.getLong(), bb.getLong()); + assertEquals(u1, actualUuid); + reader.next(); + uuidReader = reader.reader(); + uuidReader.read(holder); + bb = ByteBuffer.wrap(holder.value); + actualUuid = new UUID(bb.getLong(), bb.getLong()); + assertEquals(u2, actualUuid); + + // Verify second list + reader.setPosition(1); + assertTrue(reader.isSet(), "second list shouldn't be null"); + reader.next(); + uuidReader = reader.reader(); + uuidReader.read(holder); + bb = ByteBuffer.wrap(holder.value); + actualUuid = new UUID(bb.getLong(), bb.getLong()); + assertEquals(u3, actualUuid); + reader.next(); + uuidReader = reader.reader(); + uuidReader.read(holder); + bb = ByteBuffer.wrap(holder.value); + actualUuid = new UUID(bb.getLong(), bb.getLong()); + assertEquals(u4, actualUuid); + reader.next(); + uuidReader = reader.reader(); + assertFalse(uuidReader.isSet(), "third element should be null"); + } + } + private void writeIntValues(UnionListWriter writer, int[] values) { writer.startList(); for (int v : values) { From 9013a6c7d8034447d8b2c3e63fef918d0a8057bb Mon Sep 17 00:00:00 2001 From: jhrotko Date: Tue, 28 Oct 2025 00:55:08 +0000 Subject: [PATCH 02/12] Add makeTransferPair w/ extended factory --- .../arrow/vector/BaseFixedWidthVector.java | 7 +++++ .../apache/arrow/vector/BaseValueVector.java | 6 +++++ .../arrow/vector/BaseVariableWidthVector.java | 7 +++++ .../org/apache/arrow/vector/NullVector.java | 6 +++++ .../org/apache/arrow/vector/ValueVector.java | 2 ++ .../complex/AbstractContainerVector.java | 7 +++++ .../arrow/vector/complex/LargeListVector.java | 26 +++++++++++-------- .../arrow/vector/complex/ListVector.java | 25 ++++++++++-------- .../complex/impl/UnionExtensionWriter.java | 7 ++++- .../util/TransferPairWithExtendedType.java | 23 ---------------- .../arrow/vector/TestLargeListVector.java | 5 ++-- .../apache/arrow/vector/TestListVector.java | 9 ++++--- 12 files changed, 78 insertions(+), 52 deletions(-) delete mode 100644 vector/src/main/java/org/apache/arrow/vector/util/TransferPairWithExtendedType.java diff --git a/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java b/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java index f6e2a3b225..aae1c9a681 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java @@ -30,6 +30,7 @@ import org.apache.arrow.memory.util.hash.ArrowBufHasher; import org.apache.arrow.util.Preconditions; import org.apache.arrow.vector.compare.VectorVisitor; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.ipc.message.ArrowFieldNode; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.util.CallBack; @@ -901,4 +902,10 @@ public int hashCode(int index, ArrowBufHasher hasher) { public OUT accept(VectorVisitor visitor, IN value) { return visitor.visit(this, value); } + + @Override + public TransferPair makeTransferPair( + ValueVector target, ExtensionTypeWriterFactory writerFactory) { + throw new UnsupportedOperationException(); + } } diff --git a/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java b/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java index cc57cde29e..8f17000e19 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java @@ -384,4 +384,10 @@ protected void allocateValidityBuffer(long byteSizeTarget) { validityBuffer.readerIndex(0); validityBuffer.setZero(0, validityBuffer.capacity()); } + + @Override + public TransferPair makeTransferPair( + ValueVector target, ExtensionTypeWriterFactory writerFactory) { + throw new UnsupportedOperationException(); + } } diff --git a/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java b/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java index 96e2afbd29..9ebbfa17a2 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java @@ -31,6 +31,7 @@ import org.apache.arrow.memory.util.hash.ArrowBufHasher; import org.apache.arrow.util.Preconditions; import org.apache.arrow.vector.compare.VectorVisitor; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.ipc.message.ArrowFieldNode; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.util.CallBack; @@ -1443,4 +1444,10 @@ public OUT accept(VectorVisitor visitor, IN value) { public final int getEndOffset(int index) { return offsetBuffer.getInt((long) (index + 1) * OFFSET_WIDTH); } + + @Override + public TransferPair makeTransferPair( + ValueVector target, ExtensionTypeWriterFactory writerFactory) { + throw new UnsupportedOperationException(); + } } diff --git a/vector/src/main/java/org/apache/arrow/vector/NullVector.java b/vector/src/main/java/org/apache/arrow/vector/NullVector.java index 0d6dab2837..736dc3ec1e 100644 --- a/vector/src/main/java/org/apache/arrow/vector/NullVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/NullVector.java @@ -201,6 +201,12 @@ public TransferPair makeTransferPair(ValueVector target) { return new TransferImpl((NullVector) target); } + @Override + public TransferPair makeTransferPair( + ValueVector target, ExtensionTypeWriterFactory writerFactory) { + return makeTransferPair(target); + } + @Override public FieldReader getReader() { return NullReader.INSTANCE; diff --git a/vector/src/main/java/org/apache/arrow/vector/ValueVector.java b/vector/src/main/java/org/apache/arrow/vector/ValueVector.java index e0628c2ee1..fe10e49e54 100644 --- a/vector/src/main/java/org/apache/arrow/vector/ValueVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/ValueVector.java @@ -190,6 +190,8 @@ public interface ValueVector extends Closeable, Iterable { */ TransferPair makeTransferPair(ValueVector target); + TransferPair makeTransferPair(ValueVector target, ExtensionTypeWriterFactory writerFactory); + /** * Get a reader for this vector. * diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java index 429f9884bb..f455479c76 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java @@ -30,6 +30,7 @@ import org.apache.arrow.vector.types.pojo.ArrowType.Struct; import org.apache.arrow.vector.types.pojo.FieldType; import org.apache.arrow.vector.util.CallBack; +import org.apache.arrow.vector.util.TransferPair; import org.apache.arrow.vector.util.ValueVectorUtility; /** @@ -168,4 +169,10 @@ public void copyFromSafe( public String getName() { return name; } + + @Override + public TransferPair makeTransferPair( + ValueVector target, ExtensionTypeWriterFactory writerFactory) { + throw new UnsupportedOperationException(); + } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java index 1b9e97e1cc..c02f9777cc 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java @@ -63,7 +63,6 @@ import org.apache.arrow.vector.util.OversizedAllocationException; import org.apache.arrow.vector.util.SchemaChangeRuntimeException; import org.apache.arrow.vector.util.TransferPair; -import org.apache.arrow.vector.util.TransferPairWithExtendedType; /** * A list vector contains lists of a specific type of elements. Its structure contains 3 elements. @@ -442,8 +441,7 @@ private void reallocValidityBuffer() { if (validityAllocationSizeInBytes > 0) { newAllocationSize = validityAllocationSizeInBytes; } else { - newAllocationSize = - BitVectorHelper.getValidityBufferSizeFromCount(INITIAL_VALUE_ALLOCATION) * 2L; + newAllocationSize = getValidityBufferSizeFromCount(INITIAL_VALUE_ALLOCATION) * 2L; } } newAllocationSize = CommonUtil.nextPowerOfTwo(newAllocationSize); @@ -570,6 +568,12 @@ public TransferPair makeTransferPair(ValueVector target) { return new TransferImpl((LargeListVector) target); } + @Override + public TransferPair makeTransferPair( + ValueVector target, ExtensionTypeWriterFactory writerFactory) { + return new TransferImpl((LargeListVector) target, writerFactory); + } + @Override public long getValidityBufferAddress() { return validityBuffer.memoryAddress(); @@ -649,10 +653,11 @@ public UnionVector promoteToUnion() { return vector; } - private class TransferImpl implements TransferPairWithExtendedType { + private class TransferImpl implements TransferPair { LargeListVector to; TransferPair dataTransferPair; + ExtensionTypeWriterFactory writerFactory; public TransferImpl(String name, BufferAllocator allocator, CallBack callBack) { this(new LargeListVector(name, allocator, field.getFieldType(), callBack)); @@ -662,6 +667,11 @@ public TransferImpl(Field field, BufferAllocator allocator, CallBack callBack) { this(new LargeListVector(field, allocator, callBack)); } + public TransferImpl(LargeListVector to, ExtensionTypeWriterFactory writerFactory) { + this(to); + this.writerFactory = writerFactory; + } + public TransferImpl(LargeListVector to) { this.to = to; to.addOrGetVector(vector.getField().getFieldType()); @@ -730,13 +740,7 @@ public ValueVector getTo() { @Override public void copyValueSafe(int from, int to) { - this.to.copyFrom(from, to, LargeListVector.this); - } - - @Override - public void copyValueSafe( - int from, int to, ExtensionTypeWriterFactory extensionTypeWriterFactory) { - this.to.copyFrom(from, to, LargeListVector.this, extensionTypeWriterFactory); + this.to.copyFrom(from, to, LargeListVector.this, writerFactory); } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java index 4bd7125ff5..65ed527bbf 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java @@ -56,7 +56,6 @@ import org.apache.arrow.vector.util.JsonStringArrayList; import org.apache.arrow.vector.util.OversizedAllocationException; import org.apache.arrow.vector.util.TransferPair; -import org.apache.arrow.vector.util.TransferPairWithExtendedType; /** * A list vector contains lists of a specific type of elements. Its structure contains 3 elements. @@ -366,8 +365,7 @@ private long getNewAllocationSize(int currentBufferCapacity) { if (validityAllocationSizeInBytes > 0) { newAllocationSize = validityAllocationSizeInBytes; } else { - newAllocationSize = - BitVectorHelper.getValidityBufferSizeFromCount(INITIAL_VALUE_ALLOCATION) * 2L; + newAllocationSize = getValidityBufferSizeFromCount(INITIAL_VALUE_ALLOCATION) * 2L; } } newAllocationSize = CommonUtil.nextPowerOfTwo(newAllocationSize); @@ -475,6 +473,11 @@ public TransferPair makeTransferPair(ValueVector target) { return new TransferImpl((ListVector) target); } + public TransferPair makeTransferPair( + ValueVector target, ExtensionTypeWriterFactory writerFactory) { + return new TransferImpl((ListVector) target, writerFactory); + } + @Override public long getValidityBufferAddress() { return validityBuffer.memoryAddress(); @@ -529,10 +532,11 @@ public OUT accept(VectorVisitor visitor, IN value) { return visitor.visit(this, value); } - private class TransferImpl implements TransferPairWithExtendedType { + private class TransferImpl implements TransferPair { ListVector to; TransferPair dataTransferPair; + ExtensionTypeWriterFactory writerFactory; public TransferImpl(String name, BufferAllocator allocator, CallBack callBack) { this(new ListVector(name, allocator, field.getFieldType(), callBack)); @@ -542,6 +546,11 @@ public TransferImpl(Field field, BufferAllocator allocator, CallBack callBack) { this(new ListVector(field, allocator, callBack)); } + public TransferImpl(ListVector to, ExtensionTypeWriterFactory writerFactory) { + this(to); + this.writerFactory = writerFactory; + } + public TransferImpl(ListVector to) { this.to = to; to.addOrGetVector(vector.getField().getFieldType()); @@ -611,13 +620,7 @@ public ValueVector getTo() { @Override public void copyValueSafe(int from, int to) { - this.to.copyFrom(from, to, ListVector.this); - } - - @Override - public void copyValueSafe( - int from, int to, ExtensionTypeWriterFactory extensionTypeWriterFactory) { - this.to.copyFrom(from, to, ListVector.this, extensionTypeWriterFactory); + this.to.copyFrom(from, to, ListVector.this, writerFactory); } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java b/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java index 4219069cba..d288c3b1c8 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java @@ -79,6 +79,11 @@ public void setPosition(int index) { @Override public void writeNull() { - this.writer.writeNull(); + if (this.writer != null) { + this.writer.writeNull(); + } else { + this.vector.setNull(getPosition()); + this.vector.setValueCount(getPosition() + 1); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/util/TransferPairWithExtendedType.java b/vector/src/main/java/org/apache/arrow/vector/util/TransferPairWithExtendedType.java deleted file mode 100644 index 848e983bad..0000000000 --- a/vector/src/main/java/org/apache/arrow/vector/util/TransferPairWithExtendedType.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.arrow.vector.util; - -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; - -public interface TransferPairWithExtendedType extends TransferPair { - void copyValueSafe(int from, int to, ExtensionTypeWriterFactory extensionTypeWriterFactory); -} diff --git a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java index f94a362e67..0dd22df4dd 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java @@ -1063,8 +1063,9 @@ public void testCopyValueSafeForExtensionType() throws Exception { // Use copyFromSafe with ExtensionTypeWriterFactory // This internally calls TransferImpl.copyValueSafe with ExtensionTypeWriterFactory outVector.allocateNew(); - outVector.copyFromSafe(0, 0, inVector, new UuidWriterFactory()); - outVector.copyFromSafe(1, 1, inVector, new UuidWriterFactory()); + TransferPair tp = inVector.makeTransferPair(outVector, new UuidWriterFactory()); + tp.copyValueSafe(0, 0); + tp.copyValueSafe(1, 1); outVector.setValueCount(2); // Verify first list diff --git a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java index b81ca61e4c..9745921c0c 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java @@ -1346,11 +1346,12 @@ public void testCopyValueSafeForExtensionType() throws Exception { writer.endList(); writer.setValueCount(2); - // Use copyFromSafe with ExtensionTypeWriterFactory - // This internally calls TransferImpl.copyValueSafe with ExtensionTypeWriterFactory + // Use TransferPair with ExtensionTypeWriterFactory + // This tests the new makeTransferPair API with writerFactory parameter outVector.allocateNew(); - outVector.copyFromSafe(0, 0, inVector, new UuidWriterFactory()); - outVector.copyFromSafe(1, 1, inVector, new UuidWriterFactory()); + TransferPair transferPair = inVector.makeTransferPair(outVector, new UuidWriterFactory()); + transferPair.copyValueSafe(0, 0); + transferPair.copyValueSafe(1, 1); outVector.setValueCount(2); // Verify first list From 26a8ba82c13626725b69b4f70961c2379a09ad68 Mon Sep 17 00:00:00 2001 From: jhrotko Date: Wed, 29 Oct 2025 16:10:16 +0000 Subject: [PATCH 03/12] Move ExtensionFactory to TransferPair --- .../codegen/templates/DenseUnionVector.java | 5 ++++ .../main/codegen/templates/UnionVector.java | 5 ++++ .../arrow/vector/BaseFixedWidthVector.java | 7 ----- .../apache/arrow/vector/BaseValueVector.java | 6 ----- .../arrow/vector/BaseVariableWidthVector.java | 7 ----- .../org/apache/arrow/vector/BigIntVector.java | 7 +++++ .../org/apache/arrow/vector/BitVector.java | 7 +++++ .../apache/arrow/vector/DateDayVector.java | 7 +++++ .../apache/arrow/vector/DateMilliVector.java | 7 +++++ .../apache/arrow/vector/Decimal256Vector.java | 7 +++++ .../apache/arrow/vector/DecimalVector.java | 7 +++++ .../apache/arrow/vector/DurationVector.java | 7 +++++ .../arrow/vector/FixedSizeBinaryVector.java | 7 +++++ .../org/apache/arrow/vector/Float2Vector.java | 7 +++++ .../org/apache/arrow/vector/Float4Vector.java | 7 +++++ .../org/apache/arrow/vector/Float8Vector.java | 7 +++++ .../org/apache/arrow/vector/IntVector.java | 7 +++++ .../arrow/vector/IntervalDayVector.java | 7 +++++ .../vector/IntervalMonthDayNanoVector.java | 7 +++++ .../arrow/vector/IntervalYearVector.java | 7 +++++ .../arrow/vector/LargeVarBinaryVector.java | 7 +++++ .../arrow/vector/LargeVarCharVector.java | 7 +++++ .../org/apache/arrow/vector/NullVector.java | 11 ++++---- .../apache/arrow/vector/SmallIntVector.java | 7 +++++ .../apache/arrow/vector/TimeMicroVector.java | 7 +++++ .../apache/arrow/vector/TimeMilliVector.java | 7 +++++ .../apache/arrow/vector/TimeNanoVector.java | 7 +++++ .../apache/arrow/vector/TimeSecVector.java | 7 +++++ .../apache/arrow/vector/TimeStampVector.java | 7 +++++ .../apache/arrow/vector/TinyIntVector.java | 7 +++++ .../org/apache/arrow/vector/UInt1Vector.java | 7 +++++ .../org/apache/arrow/vector/UInt2Vector.java | 7 +++++ .../org/apache/arrow/vector/UInt4Vector.java | 7 +++++ .../org/apache/arrow/vector/UInt8Vector.java | 7 +++++ .../org/apache/arrow/vector/ValueVector.java | 2 -- .../apache/arrow/vector/VarBinaryVector.java | 7 +++++ .../apache/arrow/vector/VarCharVector.java | 7 +++++ .../arrow/vector/ViewVarBinaryVector.java | 7 +++++ .../arrow/vector/ViewVarCharVector.java | 7 +++++ .../org/apache/arrow/vector/ZeroVector.java | 4 +++ .../complex/AbstractContainerVector.java | 7 ----- .../vector/complex/FixedSizeListVector.java | 27 ++++++++++++++----- .../arrow/vector/complex/LargeListVector.java | 20 +++++--------- .../vector/complex/LargeListViewVector.java | 5 ++++ .../arrow/vector/complex/ListVector.java | 19 +++++-------- .../arrow/vector/complex/ListViewVector.java | 5 ++++ .../arrow/vector/complex/MapVector.java | 6 +++++ .../complex/NonNullableStructVector.java | 24 +++++++++++++++++ .../vector/complex/RunEndEncodedVector.java | 6 +++++ .../arrow/vector/complex/StructVector.java | 20 +++++++++++--- .../arrow/vector/util/TransferPair.java | 3 +++ .../arrow/vector/TestLargeListVector.java | 6 ++--- .../apache/arrow/vector/TestListVector.java | 6 ++--- .../org/apache/arrow/vector/UuidVector.java | 7 +++++ 54 files changed, 356 insertions(+), 76 deletions(-) diff --git a/vector/src/main/codegen/templates/DenseUnionVector.java b/vector/src/main/codegen/templates/DenseUnionVector.java index e9a9a2878b..6bd3163f38 100644 --- a/vector/src/main/codegen/templates/DenseUnionVector.java +++ b/vector/src/main/codegen/templates/DenseUnionVector.java @@ -707,6 +707,11 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, DenseUnionVector.this); } + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { + this.to.copyFrom(from, to, DenseUnionVector.this, writerFactory); + } } @Override diff --git a/vector/src/main/codegen/templates/UnionVector.java b/vector/src/main/codegen/templates/UnionVector.java index 67efdf60f7..56c430d29d 100644 --- a/vector/src/main/codegen/templates/UnionVector.java +++ b/vector/src/main/codegen/templates/UnionVector.java @@ -620,6 +620,11 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, UnionVector.this); } + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { + this.to.copyFrom(from, to, UnionVector.this, writerFactory); + } } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java b/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java index aae1c9a681..f6e2a3b225 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BaseFixedWidthVector.java @@ -30,7 +30,6 @@ import org.apache.arrow.memory.util.hash.ArrowBufHasher; import org.apache.arrow.util.Preconditions; import org.apache.arrow.vector.compare.VectorVisitor; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.ipc.message.ArrowFieldNode; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.util.CallBack; @@ -902,10 +901,4 @@ public int hashCode(int index, ArrowBufHasher hasher) { public OUT accept(VectorVisitor visitor, IN value) { return visitor.visit(this, value); } - - @Override - public TransferPair makeTransferPair( - ValueVector target, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException(); - } } diff --git a/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java b/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java index 8f17000e19..cc57cde29e 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java @@ -384,10 +384,4 @@ protected void allocateValidityBuffer(long byteSizeTarget) { validityBuffer.readerIndex(0); validityBuffer.setZero(0, validityBuffer.capacity()); } - - @Override - public TransferPair makeTransferPair( - ValueVector target, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException(); - } } diff --git a/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java b/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java index 9ebbfa17a2..96e2afbd29 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java @@ -31,7 +31,6 @@ import org.apache.arrow.memory.util.hash.ArrowBufHasher; import org.apache.arrow.util.Preconditions; import org.apache.arrow.vector.compare.VectorVisitor; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.ipc.message.ArrowFieldNode; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.util.CallBack; @@ -1444,10 +1443,4 @@ public OUT accept(VectorVisitor visitor, IN value) { public final int getEndOffset(int index) { return offsetBuffer.getInt((long) (index + 1) * OFFSET_WIDTH); } - - @Override - public TransferPair makeTransferPair( - ValueVector target, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException(); - } } diff --git a/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java b/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java index 21fa39af8b..11a678ff0a 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java @@ -21,6 +21,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.vector.complex.impl.BigIntReaderImpl; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.BigIntHolder; import org.apache.arrow.vector.holders.NullableBigIntHolder; @@ -350,5 +351,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, BigIntVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/BitVector.java b/vector/src/main/java/org/apache/arrow/vector/BitVector.java index ecee02f665..354c9186a8 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BitVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BitVector.java @@ -25,6 +25,7 @@ import org.apache.arrow.memory.util.hash.ArrowBufHasher; import org.apache.arrow.util.Preconditions; import org.apache.arrow.vector.complex.impl.BitReaderImpl; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.BitHolder; import org.apache.arrow.vector.holders.NullableBitHolder; @@ -592,5 +593,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, BitVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java b/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java index 68e1e79bd8..1e3dce996b 100644 --- a/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java @@ -21,6 +21,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.vector.complex.impl.DateDayReaderImpl; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.DateDayHolder; import org.apache.arrow.vector.holders.NullableDateDayHolder; @@ -336,5 +337,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, DateDayVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java b/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java index 70b955b8f8..2e096d1ec8 100644 --- a/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java @@ -22,6 +22,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.vector.complex.impl.DateMilliReaderImpl; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.DateMilliHolder; import org.apache.arrow.vector.holders.NullableDateMilliHolder; @@ -338,5 +339,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, DateMilliVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/Decimal256Vector.java b/vector/src/main/java/org/apache/arrow/vector/Decimal256Vector.java index f9d7e5cb9e..3da9999610 100644 --- a/vector/src/main/java/org/apache/arrow/vector/Decimal256Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/Decimal256Vector.java @@ -24,6 +24,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.util.MemoryUtil; import org.apache.arrow.vector.complex.impl.Decimal256ReaderImpl; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.Decimal256Holder; import org.apache.arrow.vector.holders.NullableDecimal256Holder; @@ -601,5 +602,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, Decimal256Vector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java b/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java index 9bf1812cc6..3ffa50324a 100644 --- a/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java @@ -24,6 +24,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.util.MemoryUtil; import org.apache.arrow.vector.complex.impl.DecimalReaderImpl; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.DecimalHolder; import org.apache.arrow.vector.holders.NullableDecimalHolder; @@ -598,5 +599,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, DecimalVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/DurationVector.java b/vector/src/main/java/org/apache/arrow/vector/DurationVector.java index 817f95d9d5..9ac2921452 100644 --- a/vector/src/main/java/org/apache/arrow/vector/DurationVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/DurationVector.java @@ -23,6 +23,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.vector.complex.impl.DurationReaderImpl; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.DurationHolder; import org.apache.arrow.vector.holders.NullableDurationHolder; @@ -409,5 +410,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, DurationVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/FixedSizeBinaryVector.java b/vector/src/main/java/org/apache/arrow/vector/FixedSizeBinaryVector.java index 2005036c78..55dca0bbaa 100644 --- a/vector/src/main/java/org/apache/arrow/vector/FixedSizeBinaryVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/FixedSizeBinaryVector.java @@ -22,6 +22,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; import org.apache.arrow.util.Preconditions; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.FixedSizeBinaryReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.FixedSizeBinaryHolder; @@ -419,5 +420,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, FixedSizeBinaryVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/Float2Vector.java b/vector/src/main/java/org/apache/arrow/vector/Float2Vector.java index 021e035d57..daa9b98fbc 100644 --- a/vector/src/main/java/org/apache/arrow/vector/Float2Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/Float2Vector.java @@ -21,6 +21,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.util.Float16; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.Float2ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.Float2Holder; @@ -413,5 +414,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, Float2Vector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java b/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java index 2b81149204..945fb1912e 100644 --- a/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.Float4ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.Float4Holder; @@ -350,5 +351,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, Float4Vector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java b/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java index 6758ffde5c..c9b8cb5d58 100644 --- a/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.Float8ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.Float8Holder; @@ -350,5 +351,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, Float8Vector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/IntVector.java b/vector/src/main/java/org/apache/arrow/vector/IntVector.java index 6058539a2d..4de1c8cce3 100644 --- a/vector/src/main/java/org/apache/arrow/vector/IntVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/IntVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.IntReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.IntHolder; @@ -350,5 +351,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, IntVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java b/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java index a0ee849707..a0449d48cb 100644 --- a/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java @@ -21,6 +21,7 @@ import java.time.Duration; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.IntervalDayReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.IntervalDayHolder; @@ -433,5 +434,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, IntervalDayVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/IntervalMonthDayNanoVector.java b/vector/src/main/java/org/apache/arrow/vector/IntervalMonthDayNanoVector.java index eece3b34b8..48cda236bb 100644 --- a/vector/src/main/java/org/apache/arrow/vector/IntervalMonthDayNanoVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/IntervalMonthDayNanoVector.java @@ -22,6 +22,7 @@ import java.time.Period; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.IntervalMonthDayNanoReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.IntervalMonthDayNanoHolder; @@ -430,5 +431,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, IntervalMonthDayNanoVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java b/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java index 92b46593a3..74cdc31005 100644 --- a/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java @@ -21,6 +21,7 @@ import java.time.Period; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.IntervalYearReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.IntervalYearHolder; @@ -366,5 +367,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, IntervalYearVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/LargeVarBinaryVector.java b/vector/src/main/java/org/apache/arrow/vector/LargeVarBinaryVector.java index fe798494c9..c33c3a7eea 100644 --- a/vector/src/main/java/org/apache/arrow/vector/LargeVarBinaryVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/LargeVarBinaryVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.LargeVarBinaryReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.LargeVarBinaryHolder; @@ -313,5 +314,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, LargeVarBinaryVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/LargeVarCharVector.java b/vector/src/main/java/org/apache/arrow/vector/LargeVarCharVector.java index b7a765f310..4b05330e93 100644 --- a/vector/src/main/java/org/apache/arrow/vector/LargeVarCharVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/LargeVarCharVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.LargeVarCharReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.LargeVarCharHolder; @@ -350,5 +351,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, LargeVarCharVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/NullVector.java b/vector/src/main/java/org/apache/arrow/vector/NullVector.java index 736dc3ec1e..a24d098f90 100644 --- a/vector/src/main/java/org/apache/arrow/vector/NullVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/NullVector.java @@ -201,12 +201,6 @@ public TransferPair makeTransferPair(ValueVector target) { return new TransferImpl((NullVector) target); } - @Override - public TransferPair makeTransferPair( - ValueVector target, ExtensionTypeWriterFactory writerFactory) { - return makeTransferPair(target); - } - @Override public FieldReader getReader() { return NullReader.INSTANCE; @@ -390,5 +384,10 @@ public void copyValueSafe(int fromIndex, int toIndex) { to.valueCount = toIndex; } } + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(from, to); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java b/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java index c476694797..536bb49d76 100644 --- a/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.SmallIntReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableSmallIntHolder; @@ -377,5 +378,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, SmallIntVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java b/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java index 175303bbaf..75519aeff6 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.TimeMicroReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableTimeMicroHolder; @@ -336,5 +337,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TimeMicroVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java b/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java index c9c673cd0a..0feeb74899 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java @@ -21,6 +21,7 @@ import java.time.LocalDateTime; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.TimeMilliReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableTimeMilliHolder; @@ -339,5 +340,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TimeMilliVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java b/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java index 105d53d25f..d0a587f8e6 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.TimeNanoReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableTimeNanoHolder; @@ -336,5 +337,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TimeNanoVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java b/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java index 1b9dbf9193..9356efee1b 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.TimeSecReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableTimeSecHolder; @@ -336,5 +337,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TimeSecVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java b/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java index 59499581c3..1a7c361e1e 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.types.pojo.FieldType; import org.apache.arrow.vector.util.TransferPair; @@ -180,5 +181,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TimeStampVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java b/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java index 022475e5e1..d4e5cdd5fe 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.TinyIntReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableTinyIntHolder; @@ -377,5 +378,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TinyIntVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java b/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java index 83f8d9eeb8..f0558d07c4 100644 --- a/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UInt1ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableUInt1Holder; @@ -366,5 +367,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, UInt1Vector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java b/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java index 35330f4f91..cc992568b2 100644 --- a/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UInt2ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableUInt2Holder; @@ -351,5 +352,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, UInt2Vector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java b/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java index 22e023f6f2..38876da24b 100644 --- a/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UInt4ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableUInt4Holder; @@ -340,5 +341,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, UInt4Vector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java b/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java index f026702bb4..713aa626c7 100644 --- a/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java @@ -21,6 +21,7 @@ import java.math.BigInteger; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UInt8ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableUInt8Holder; @@ -338,5 +339,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, UInt8Vector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/ValueVector.java b/vector/src/main/java/org/apache/arrow/vector/ValueVector.java index fe10e49e54..e0628c2ee1 100644 --- a/vector/src/main/java/org/apache/arrow/vector/ValueVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/ValueVector.java @@ -190,8 +190,6 @@ public interface ValueVector extends Closeable, Iterable { */ TransferPair makeTransferPair(ValueVector target); - TransferPair makeTransferPair(ValueVector target, ExtensionTypeWriterFactory writerFactory); - /** * Get a reader for this vector. * diff --git a/vector/src/main/java/org/apache/arrow/vector/VarBinaryVector.java b/vector/src/main/java/org/apache/arrow/vector/VarBinaryVector.java index ad76504f0f..40c8764007 100644 --- a/vector/src/main/java/org/apache/arrow/vector/VarBinaryVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/VarBinaryVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.VarBinaryReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableVarBinaryHolder; @@ -313,5 +314,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, VarBinaryVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/VarCharVector.java b/vector/src/main/java/org/apache/arrow/vector/VarCharVector.java index 5ddc8b84d2..1786d81ca6 100644 --- a/vector/src/main/java/org/apache/arrow/vector/VarCharVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/VarCharVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.VarCharReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableVarCharHolder; @@ -348,5 +349,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, VarCharVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/ViewVarBinaryVector.java b/vector/src/main/java/org/apache/arrow/vector/ViewVarBinaryVector.java index c41854bb5f..cba2a50f83 100644 --- a/vector/src/main/java/org/apache/arrow/vector/ViewVarBinaryVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/ViewVarBinaryVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.ViewVarBinaryReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableViewVarBinaryHolder; @@ -295,5 +296,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, ViewVarBinaryVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/ViewVarCharVector.java b/vector/src/main/java/org/apache/arrow/vector/ViewVarCharVector.java index 9ce7f85ef6..c985e7df5b 100644 --- a/vector/src/main/java/org/apache/arrow/vector/ViewVarCharVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/ViewVarCharVector.java @@ -20,6 +20,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.ViewVarCharReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableViewVarCharHolder; @@ -343,5 +344,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, ViewVarCharVector.this); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + copyValueSafe(fromIndex, toIndex); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/ZeroVector.java b/vector/src/main/java/org/apache/arrow/vector/ZeroVector.java index c838de60d8..6a5d1bbc8d 100644 --- a/vector/src/main/java/org/apache/arrow/vector/ZeroVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/ZeroVector.java @@ -19,6 +19,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.util.ArrowBufPointer; import org.apache.arrow.memory.util.hash.ArrowBufHasher; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.types.pojo.FieldType; import org.apache.arrow.vector.util.CallBack; @@ -127,5 +128,8 @@ public ValueVector getTo() { @Override public void copyValueSafe(int from, int to) {} + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) {} }; } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java index f455479c76..429f9884bb 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java @@ -30,7 +30,6 @@ import org.apache.arrow.vector.types.pojo.ArrowType.Struct; import org.apache.arrow.vector.types.pojo.FieldType; import org.apache.arrow.vector.util.CallBack; -import org.apache.arrow.vector.util.TransferPair; import org.apache.arrow.vector.util.ValueVectorUtility; /** @@ -169,10 +168,4 @@ public void copyFromSafe( public String getName() { return name; } - - @Override - public TransferPair makeTransferPair( - ValueVector target, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException(); - } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java index e3b4ab477f..1711385f12 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java @@ -45,6 +45,7 @@ import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.ZeroVector; import org.apache.arrow.vector.compare.VectorVisitor; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UnionFixedSizeListReader; import org.apache.arrow.vector.complex.impl.UnionFixedSizeListWriter; import org.apache.arrow.vector.complex.reader.FieldReader; @@ -652,14 +653,28 @@ public ValueVector getTo() { @Override public void copyValueSafe(int fromIndex, int toIndex) { - while (toIndex >= to.getValueCapacity()) { - to.reAlloc(); + allocateAndCopyValueSafe(fromIndex, toIndex, null); + } + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { + allocateAndCopyValueSafe(from, to, writerFactory); + } + + private void allocateAndCopyValueSafe( + int from, int to, ExtensionTypeWriterFactory writerFactory) { + while (to >= this.to.getValueCapacity()) { + this.to.reAlloc(); } - BitVectorHelper.setValidityBit(to.validityBuffer, toIndex, isSet(fromIndex)); - int fromOffset = fromIndex * listSize; - int toOffset = toIndex * listSize; + BitVectorHelper.setValidityBit(this.to.validityBuffer, to, isSet(from)); + int fromOffset = from * listSize; + int toOffset = to * listSize; for (int i = 0; i < listSize; i++) { - dataPair.copyValueSafe(fromOffset + i, toOffset + i); + if (writerFactory == null) { + dataPair.copyValueSafe(fromOffset + i, toOffset + i); + } else { + dataPair.copyValueSafe(fromOffset + i, toOffset + i, writerFactory); + } } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java index c02f9777cc..f2994c5fe1 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java @@ -441,7 +441,8 @@ private void reallocValidityBuffer() { if (validityAllocationSizeInBytes > 0) { newAllocationSize = validityAllocationSizeInBytes; } else { - newAllocationSize = getValidityBufferSizeFromCount(INITIAL_VALUE_ALLOCATION) * 2L; + newAllocationSize = + BitVectorHelper.getValidityBufferSizeFromCount(INITIAL_VALUE_ALLOCATION) * 2L; } } newAllocationSize = CommonUtil.nextPowerOfTwo(newAllocationSize); @@ -568,12 +569,6 @@ public TransferPair makeTransferPair(ValueVector target) { return new TransferImpl((LargeListVector) target); } - @Override - public TransferPair makeTransferPair( - ValueVector target, ExtensionTypeWriterFactory writerFactory) { - return new TransferImpl((LargeListVector) target, writerFactory); - } - @Override public long getValidityBufferAddress() { return validityBuffer.memoryAddress(); @@ -657,7 +652,6 @@ private class TransferImpl implements TransferPair { LargeListVector to; TransferPair dataTransferPair; - ExtensionTypeWriterFactory writerFactory; public TransferImpl(String name, BufferAllocator allocator, CallBack callBack) { this(new LargeListVector(name, allocator, field.getFieldType(), callBack)); @@ -667,11 +661,6 @@ public TransferImpl(Field field, BufferAllocator allocator, CallBack callBack) { this(new LargeListVector(field, allocator, callBack)); } - public TransferImpl(LargeListVector to, ExtensionTypeWriterFactory writerFactory) { - this(to); - this.writerFactory = writerFactory; - } - public TransferImpl(LargeListVector to) { this.to = to; to.addOrGetVector(vector.getField().getFieldType()); @@ -740,6 +729,11 @@ public ValueVector getTo() { @Override public void copyValueSafe(int from, int to) { + this.to.copyFrom(from, to, LargeListVector.this); + } + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { this.to.copyFrom(from, to, LargeListVector.this, writerFactory); } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListViewVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListViewVector.java index 992a664449..107ad035e4 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListViewVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListViewVector.java @@ -552,6 +552,11 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, LargeListViewVector.this); } + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { + this.to.copyFrom(from, to, LargeListViewVector.this, writerFactory); + } } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java index 65ed527bbf..2730c21883 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java @@ -365,7 +365,8 @@ private long getNewAllocationSize(int currentBufferCapacity) { if (validityAllocationSizeInBytes > 0) { newAllocationSize = validityAllocationSizeInBytes; } else { - newAllocationSize = getValidityBufferSizeFromCount(INITIAL_VALUE_ALLOCATION) * 2L; + newAllocationSize = + BitVectorHelper.getValidityBufferSizeFromCount(INITIAL_VALUE_ALLOCATION) * 2L; } } newAllocationSize = CommonUtil.nextPowerOfTwo(newAllocationSize); @@ -473,11 +474,6 @@ public TransferPair makeTransferPair(ValueVector target) { return new TransferImpl((ListVector) target); } - public TransferPair makeTransferPair( - ValueVector target, ExtensionTypeWriterFactory writerFactory) { - return new TransferImpl((ListVector) target, writerFactory); - } - @Override public long getValidityBufferAddress() { return validityBuffer.memoryAddress(); @@ -536,7 +532,6 @@ private class TransferImpl implements TransferPair { ListVector to; TransferPair dataTransferPair; - ExtensionTypeWriterFactory writerFactory; public TransferImpl(String name, BufferAllocator allocator, CallBack callBack) { this(new ListVector(name, allocator, field.getFieldType(), callBack)); @@ -546,11 +541,6 @@ public TransferImpl(Field field, BufferAllocator allocator, CallBack callBack) { this(new ListVector(field, allocator, callBack)); } - public TransferImpl(ListVector to, ExtensionTypeWriterFactory writerFactory) { - this(to); - this.writerFactory = writerFactory; - } - public TransferImpl(ListVector to) { this.to = to; to.addOrGetVector(vector.getField().getFieldType()); @@ -620,6 +610,11 @@ public ValueVector getTo() { @Override public void copyValueSafe(int from, int to) { + this.to.copyFrom(from, to, ListVector.this); + } + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { this.to.copyFrom(from, to, ListVector.this, writerFactory); } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java index 2784240429..b8486b4fbd 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java @@ -557,6 +557,11 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, ListViewVector.this); } + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { + this.to.copyFrom(from, to, ListViewVector.this, writerFactory); + } } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java index 3f98322ba9..8927c6faef 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java @@ -25,6 +25,7 @@ import org.apache.arrow.vector.FieldVector; import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.ZeroVector; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UnionMapReader; import org.apache.arrow.vector.complex.impl.UnionMapWriter; import org.apache.arrow.vector.types.Types; @@ -240,5 +241,10 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, MapVector.this); } + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { + this.to.copyFrom(from, to, MapVector.this, writerFactory); + } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java index 5a215608ef..5c4373347d 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java @@ -31,6 +31,7 @@ import org.apache.arrow.vector.ValueIterableVector; import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.compare.VectorVisitor; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.SingleStructReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.ComplexHolder; @@ -157,11 +158,27 @@ public void copyFrom(int fromIndex, int thisIndex, ValueVector from) { ephPair.copyValueSafe(fromIndex, thisIndex); } + @Override + public void copyFrom( + int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { + Preconditions.checkArgument(this.getMinorType() == from.getMinorType()); + if (ephPair == null || ephPair.from != from) { + ephPair = (StructTransferPair) from.makeTransferPair(this); + } + ephPair.copyValueSafe(fromIndex, thisIndex, writerFactory); + } + @Override public void copyFromSafe(int fromIndex, int thisIndex, ValueVector from) { copyFrom(fromIndex, thisIndex, from); } + @Override + public void copyFromSafe( + int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { + copyFrom(fromIndex, thisIndex, from, writerFactory); + } + @Override protected boolean supportsDirectRead() { return true; @@ -358,6 +375,13 @@ public void copyValueSafe(int from, int to) { } } + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { + for (TransferPair p : pairs) { + p.copyValueSafe(from, to, writerFactory); + } + } + @Override public void splitAndTransfer(int startIndex, int length) { for (TransferPair p : pairs) { diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/RunEndEncodedVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/RunEndEncodedVector.java index b83e13449a..69fa8a2f70 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/RunEndEncodedVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/RunEndEncodedVector.java @@ -39,6 +39,7 @@ import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.ZeroVector; import org.apache.arrow.vector.compare.VectorVisitor; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.complex.writer.FieldWriter; import org.apache.arrow.vector.ipc.message.ArrowFieldNode; @@ -453,6 +454,11 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, RunEndEncodedVector.this); } + + @Override + public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { + this.to.copyFrom(from, to, RunEndEncodedVector.this, writerFactory); + } } /** diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java index 5e5bb7fc21..1334699487 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java @@ -36,6 +36,7 @@ import org.apache.arrow.vector.FieldVector; import org.apache.arrow.vector.ValueIterableVector; import org.apache.arrow.vector.ValueVector; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.NullableStructReaderImpl; import org.apache.arrow.vector.complex.impl.NullableStructWriter; import org.apache.arrow.vector.holders.ComplexHolder; @@ -292,13 +293,17 @@ public void transfer() { @Override public void copyValueSafe(int fromIndex, int toIndex) { - while (toIndex >= target.getValidityBufferValueCapacity()) { - target.reallocValidityBuffer(); - } - BitVectorHelper.setValidityBit(target.validityBuffer, toIndex, isSet(fromIndex)); + reallocateTargetValidityBuffer(fromIndex, toIndex); super.copyValueSafe(fromIndex, toIndex); } + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + reallocateTargetValidityBuffer(fromIndex, toIndex); + super.copyValueSafe(fromIndex, toIndex, writerFactory); + } + @Override public void splitAndTransfer(int startIndex, int length) { Preconditions.checkArgument( @@ -311,6 +316,13 @@ public void splitAndTransfer(int startIndex, int length) { splitAndTransferValidityBuffer(startIndex, length, target); super.splitAndTransfer(startIndex, length); } + + private void reallocateTargetValidityBuffer(int fromIndex, int toIndex) { + while (toIndex >= this.target.getValidityBufferValueCapacity()) { + target.reallocValidityBuffer(); + } + BitVectorHelper.setValidityBit(target.validityBuffer, toIndex, isSet(fromIndex)); + } } /* diff --git a/vector/src/main/java/org/apache/arrow/vector/util/TransferPair.java b/vector/src/main/java/org/apache/arrow/vector/util/TransferPair.java index aca685bacc..494a2da3a2 100644 --- a/vector/src/main/java/org/apache/arrow/vector/util/TransferPair.java +++ b/vector/src/main/java/org/apache/arrow/vector/util/TransferPair.java @@ -17,6 +17,7 @@ package org.apache.arrow.vector.util; import org.apache.arrow.vector.ValueVector; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; /** Interface for copying values between a pair of two vectors of the same type. */ public interface TransferPair { @@ -27,4 +28,6 @@ public interface TransferPair { ValueVector getTo(); void copyValueSafe(int from, int to); + + void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory); } diff --git a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java index 0dd22df4dd..0885980dbf 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java @@ -1063,9 +1063,9 @@ public void testCopyValueSafeForExtensionType() throws Exception { // Use copyFromSafe with ExtensionTypeWriterFactory // This internally calls TransferImpl.copyValueSafe with ExtensionTypeWriterFactory outVector.allocateNew(); - TransferPair tp = inVector.makeTransferPair(outVector, new UuidWriterFactory()); - tp.copyValueSafe(0, 0); - tp.copyValueSafe(1, 1); + TransferPair tp = inVector.makeTransferPair(outVector); + tp.copyValueSafe(0, 0, new UuidWriterFactory()); + tp.copyValueSafe(1, 1, new UuidWriterFactory()); outVector.setValueCount(2); // Verify first list diff --git a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java index 9745921c0c..92f484493f 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java @@ -1349,9 +1349,9 @@ public void testCopyValueSafeForExtensionType() throws Exception { // Use TransferPair with ExtensionTypeWriterFactory // This tests the new makeTransferPair API with writerFactory parameter outVector.allocateNew(); - TransferPair transferPair = inVector.makeTransferPair(outVector, new UuidWriterFactory()); - transferPair.copyValueSafe(0, 0); - transferPair.copyValueSafe(1, 1); + TransferPair transferPair = inVector.makeTransferPair(outVector); + transferPair.copyValueSafe(0, 0, new UuidWriterFactory()); + transferPair.copyValueSafe(1, 1, new UuidWriterFactory()); outVector.setValueCount(2); // Verify first list diff --git a/vector/src/test/java/org/apache/arrow/vector/UuidVector.java b/vector/src/test/java/org/apache/arrow/vector/UuidVector.java index 72ba4aa555..a5743f0d17 100644 --- a/vector/src/test/java/org/apache/arrow/vector/UuidVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/UuidVector.java @@ -20,6 +20,7 @@ import java.util.UUID; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.util.hash.ArrowBufHasher; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UuidReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holder.UuidHolder; @@ -123,5 +124,11 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { tp.copyValueSafe(fromIndex, toIndex); } + + @Override + public void copyValueSafe( + int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { + tp.copyValueSafe(fromIndex, toIndex, writerFactory); + } } } From 89520f52efc51fde244e0ca9bb3618307c85aeea Mon Sep 17 00:00:00 2001 From: jhrotko Date: Thu, 30 Oct 2025 01:46:29 +0000 Subject: [PATCH 04/12] Refactor copyvaluesafe w/ extension --- .../templates/AbstractFieldReader.java | 10 +++-- .../main/codegen/templates/BaseReader.java | 3 -- .../main/codegen/templates/ComplexCopier.java | 31 +++++---------- .../codegen/templates/DenseUnionVector.java | 4 -- .../main/codegen/templates/UnionVector.java | 4 -- .../apache/arrow/vector/BaseValueVector.java | 13 ------- .../org/apache/arrow/vector/BigIntVector.java | 7 ---- .../org/apache/arrow/vector/BitVector.java | 7 ---- .../apache/arrow/vector/DateDayVector.java | 7 ---- .../apache/arrow/vector/DateMilliVector.java | 7 ---- .../apache/arrow/vector/Decimal256Vector.java | 7 ---- .../apache/arrow/vector/DecimalVector.java | 7 ---- .../apache/arrow/vector/DurationVector.java | 7 ---- .../arrow/vector/FixedSizeBinaryVector.java | 7 ---- .../org/apache/arrow/vector/Float2Vector.java | 7 ---- .../org/apache/arrow/vector/Float4Vector.java | 7 ---- .../org/apache/arrow/vector/Float8Vector.java | 7 ---- .../org/apache/arrow/vector/IntVector.java | 7 ---- .../arrow/vector/IntervalDayVector.java | 7 ---- .../vector/IntervalMonthDayNanoVector.java | 7 ---- .../arrow/vector/IntervalYearVector.java | 7 ---- .../arrow/vector/LargeVarBinaryVector.java | 7 ---- .../arrow/vector/LargeVarCharVector.java | 7 ---- .../org/apache/arrow/vector/NullVector.java | 18 --------- .../apache/arrow/vector/SmallIntVector.java | 7 ---- .../apache/arrow/vector/TimeMicroVector.java | 7 ---- .../apache/arrow/vector/TimeMilliVector.java | 7 ---- .../apache/arrow/vector/TimeNanoVector.java | 7 ---- .../apache/arrow/vector/TimeSecVector.java | 7 ---- .../apache/arrow/vector/TimeStampVector.java | 7 ---- .../apache/arrow/vector/TinyIntVector.java | 7 ---- .../org/apache/arrow/vector/UInt1Vector.java | 7 ---- .../org/apache/arrow/vector/UInt2Vector.java | 7 ---- .../org/apache/arrow/vector/UInt4Vector.java | 7 ---- .../org/apache/arrow/vector/UInt8Vector.java | 7 ---- .../org/apache/arrow/vector/ValueVector.java | 25 ------------ .../apache/arrow/vector/VarBinaryVector.java | 7 ---- .../apache/arrow/vector/VarCharVector.java | 7 ---- .../arrow/vector/ViewVarBinaryVector.java | 7 ---- .../arrow/vector/ViewVarCharVector.java | 7 ---- .../org/apache/arrow/vector/ZeroVector.java | 4 -- .../complex/AbstractContainerVector.java | 13 ------- .../vector/complex/FixedSizeListVector.java | 25 +++--------- .../arrow/vector/complex/LargeListVector.java | 38 +------------------ .../vector/complex/LargeListViewVector.java | 20 ---------- .../arrow/vector/complex/ListVector.java | 38 +------------------ .../arrow/vector/complex/ListViewVector.java | 20 +--------- .../arrow/vector/complex/MapVector.java | 6 --- .../complex/NonNullableStructVector.java | 24 ------------ .../vector/complex/RunEndEncodedVector.java | 6 --- .../arrow/vector/complex/StructVector.java | 8 ---- .../complex/impl/AbstractBaseReader.java | 9 +---- .../complex/impl/UnionLargeListReader.java | 4 -- .../complex/reader/ExtensionReader.java | 3 ++ .../vector/complex/reader/FieldReader.java | 1 + .../arrow/vector/util/TransferPair.java | 3 -- .../arrow/vector/TestLargeListVector.java | 4 +- .../apache/arrow/vector/TestListVector.java | 6 +-- .../apache/arrow/vector/TestMapVector.java | 2 +- .../org/apache/arrow/vector/UuidVector.java | 7 ---- .../complex/impl/TestComplexCopier.java | 6 +-- .../vector/complex/impl/UuidReaderImpl.java | 5 +++ 62 files changed, 43 insertions(+), 541 deletions(-) diff --git a/vector/src/main/codegen/templates/AbstractFieldReader.java b/vector/src/main/codegen/templates/AbstractFieldReader.java index c7c5b4d78d..efb87c71dc 100644 --- a/vector/src/main/codegen/templates/AbstractFieldReader.java +++ b/vector/src/main/codegen/templates/AbstractFieldReader.java @@ -109,10 +109,6 @@ public void copyAsField(String name, ${name}Writer writer) { - public void copyAsValue(StructWriter writer, ExtensionTypeWriterFactory writerFactory) { - fail("CopyAsValue StructWriter"); - } - public void read(ExtensionHolder holder) { fail("Extension"); } @@ -144,7 +140,13 @@ public int size() { return -1; } + @Override + public ExtensionTypeWriterFactory getExtensionTypeWriterFactory() { + throw new IllegalStateException("The current reader doesn't support reading extension type"); + } + private void fail(String name) { throw new IllegalArgumentException(String.format("You tried to read a [%s] type when you are using a field reader of type [%s].", name, this.getClass().getSimpleName())); } + } diff --git a/vector/src/main/codegen/templates/BaseReader.java b/vector/src/main/codegen/templates/BaseReader.java index 4c6f49ab9b..c52345af21 100644 --- a/vector/src/main/codegen/templates/BaseReader.java +++ b/vector/src/main/codegen/templates/BaseReader.java @@ -49,7 +49,6 @@ public interface RepeatedStructReader extends StructReader{ boolean next(); int size(); void copyAsValue(StructWriter writer); - void copyAsValue(StructWriter writer, ExtensionTypeWriterFactory writerFactory); } public interface ListReader extends BaseReader{ @@ -60,7 +59,6 @@ public interface RepeatedListReader extends ListReader{ boolean next(); int size(); void copyAsValue(ListWriter writer); - void copyAsValue(ListWriter writer, ExtensionTypeWriterFactory writerFactory); } public interface MapReader extends BaseReader{ @@ -71,7 +69,6 @@ public interface RepeatedMapReader extends MapReader{ boolean next(); int size(); void copyAsValue(MapWriter writer); - void copyAsValue(MapWriter writer, ExtensionTypeWriterFactory writerFactory); } public interface ScalarReader extends diff --git a/vector/src/main/codegen/templates/ComplexCopier.java b/vector/src/main/codegen/templates/ComplexCopier.java index e9c4d4d6b9..9b064f733a 100644 --- a/vector/src/main/codegen/templates/ComplexCopier.java +++ b/vector/src/main/codegen/templates/ComplexCopier.java @@ -42,14 +42,10 @@ public class ComplexCopier { * @param output field to write to */ public static void copy(FieldReader input, FieldWriter output) { - writeValue(input, output, null); + writeValue(input, output); } - public static void copy(FieldReader input, FieldWriter output, ExtensionTypeWriterFactory extensionTypeWriterFactory) { - writeValue(input, output, extensionTypeWriterFactory); - } - - private static void writeValue(FieldReader reader, FieldWriter writer, ExtensionTypeWriterFactory extensionTypeWriterFactory) { + private static void writeValue(FieldReader reader, FieldWriter writer) { final MinorType mt = reader.getMinorType(); switch (mt) { @@ -63,9 +59,9 @@ private static void writeValue(FieldReader reader, FieldWriter writer, Extension writer.startList(); while (reader.next()) { FieldReader childReader = reader.reader(); - FieldWriter childWriter = getListWriterForReader(childReader, writer, extensionTypeWriterFactory); + FieldWriter childWriter = getListWriterForReader(childReader, writer); if (childReader.isSet()) { - writeValue(childReader, childWriter, extensionTypeWriterFactory); + writeValue(childReader, childWriter); } else { childWriter.writeNull(); } @@ -83,8 +79,8 @@ private static void writeValue(FieldReader reader, FieldWriter writer, Extension FieldReader structReader = reader.reader(); if (structReader.isSet()) { writer.startEntry(); - writeValue(mapReader.key(), getMapWriterForReader(mapReader.key(), writer.key()), extensionTypeWriterFactory); - writeValue(mapReader.value(), getMapWriterForReader(mapReader.value(), writer.value()), extensionTypeWriterFactory); + writeValue(mapReader.key(), getMapWriterForReader(mapReader.key(), writer.key())); + writeValue(mapReader.value(), getMapWriterForReader(mapReader.value(), writer.value())); writer.endEntry(); } else { writer.writeNull(); @@ -103,7 +99,7 @@ private static void writeValue(FieldReader reader, FieldWriter writer, Extension if (childReader.getMinorType() != Types.MinorType.NULL) { FieldWriter childWriter = getStructWriterForReader(childReader, writer, name); if (childReader.isSet()) { - writeValue(childReader, childWriter, extensionTypeWriterFactory); + writeValue(childReader, childWriter); } else { childWriter.writeNull(); } @@ -115,13 +111,11 @@ private static void writeValue(FieldReader reader, FieldWriter writer, Extension } break; case EXTENSIONTYPE: - if (extensionTypeWriterFactory == null) { - throw new IllegalArgumentException("Must provide ExtensionTypeWriterFactory"); - } if (reader.isSet()) { Object value = reader.readObject(); if (value != null) { - writer.addExtensionTypeWriterFactory(extensionTypeWriterFactory); + ExtensionTypeWriterFactory writerFactory = reader.getExtensionTypeWriterFactory(); + writer.addExtensionTypeWriterFactory(writerFactory); writer.writeExtension(value); } } else { @@ -189,10 +183,6 @@ private static FieldWriter getStructWriterForReader(FieldReader reader, StructWr } private static FieldWriter getListWriterForReader(FieldReader reader, ListWriter writer) { - return getListWriterForReader(reader, writer, null); - } - - private static FieldWriter getListWriterForReader(FieldReader reader, ListWriter writer, ExtensionTypeWriterFactory extensionTypeWriterFactory) { switch (reader.getMinorType()) { <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first /> <#assign fields = minor.fields!type.fields /> @@ -213,9 +203,6 @@ private static FieldWriter getListWriterForReader(FieldReader reader, ListWriter return (FieldWriter) writer.listView(); case EXTENSIONTYPE: ExtensionWriter extensionWriter = writer.extension(reader.getField().getType()); - if (extensionTypeWriterFactory != null) { - extensionWriter.addExtensionTypeWriterFactory(extensionTypeWriterFactory); - } return (FieldWriter) extensionWriter; default: throw new UnsupportedOperationException(reader.getMinorType().toString()); diff --git a/vector/src/main/codegen/templates/DenseUnionVector.java b/vector/src/main/codegen/templates/DenseUnionVector.java index 6bd3163f38..fb8486fbd3 100644 --- a/vector/src/main/codegen/templates/DenseUnionVector.java +++ b/vector/src/main/codegen/templates/DenseUnionVector.java @@ -708,10 +708,6 @@ public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, DenseUnionVector.this); } - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - this.to.copyFrom(from, to, DenseUnionVector.this, writerFactory); - } } @Override diff --git a/vector/src/main/codegen/templates/UnionVector.java b/vector/src/main/codegen/templates/UnionVector.java index 56c430d29d..2a32842b0e 100644 --- a/vector/src/main/codegen/templates/UnionVector.java +++ b/vector/src/main/codegen/templates/UnionVector.java @@ -621,10 +621,6 @@ public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, UnionVector.this); } - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - this.to.copyFrom(from, to, UnionVector.this, writerFactory); - } } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java b/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java index cc57cde29e..37dfa20616 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BaseValueVector.java @@ -22,7 +22,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReferenceManager; import org.apache.arrow.util.Preconditions; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.util.DataSizeRoundingUtil; import org.apache.arrow.vector.util.TransferPair; @@ -261,18 +260,6 @@ public void copyFromSafe(int fromIndex, int thisIndex, ValueVector from) { throw new UnsupportedOperationException(); } - @Override - public void copyFrom( - int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException(); - } - - @Override - public void copyFromSafe( - int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException(); - } - /** * Transfer the validity buffer from `validityBuffer` to the target vector's `validityBuffer`. * Start at `startIndex` and copy `length` number of elements. If the starting index is 8 byte diff --git a/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java b/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java index 11a678ff0a..21fa39af8b 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BigIntVector.java @@ -21,7 +21,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.vector.complex.impl.BigIntReaderImpl; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.BigIntHolder; import org.apache.arrow.vector.holders.NullableBigIntHolder; @@ -351,11 +350,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, BigIntVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/BitVector.java b/vector/src/main/java/org/apache/arrow/vector/BitVector.java index 354c9186a8..ecee02f665 100644 --- a/vector/src/main/java/org/apache/arrow/vector/BitVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/BitVector.java @@ -25,7 +25,6 @@ import org.apache.arrow.memory.util.hash.ArrowBufHasher; import org.apache.arrow.util.Preconditions; import org.apache.arrow.vector.complex.impl.BitReaderImpl; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.BitHolder; import org.apache.arrow.vector.holders.NullableBitHolder; @@ -593,11 +592,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, BitVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java b/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java index 1e3dce996b..68e1e79bd8 100644 --- a/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/DateDayVector.java @@ -21,7 +21,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.vector.complex.impl.DateDayReaderImpl; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.DateDayHolder; import org.apache.arrow.vector.holders.NullableDateDayHolder; @@ -337,11 +336,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, DateDayVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java b/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java index 2e096d1ec8..70b955b8f8 100644 --- a/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/DateMilliVector.java @@ -22,7 +22,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.vector.complex.impl.DateMilliReaderImpl; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.DateMilliHolder; import org.apache.arrow.vector.holders.NullableDateMilliHolder; @@ -339,11 +338,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, DateMilliVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/Decimal256Vector.java b/vector/src/main/java/org/apache/arrow/vector/Decimal256Vector.java index 3da9999610..f9d7e5cb9e 100644 --- a/vector/src/main/java/org/apache/arrow/vector/Decimal256Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/Decimal256Vector.java @@ -24,7 +24,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.util.MemoryUtil; import org.apache.arrow.vector.complex.impl.Decimal256ReaderImpl; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.Decimal256Holder; import org.apache.arrow.vector.holders.NullableDecimal256Holder; @@ -602,11 +601,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, Decimal256Vector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java b/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java index 3ffa50324a..9bf1812cc6 100644 --- a/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/DecimalVector.java @@ -24,7 +24,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.util.MemoryUtil; import org.apache.arrow.vector.complex.impl.DecimalReaderImpl; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.DecimalHolder; import org.apache.arrow.vector.holders.NullableDecimalHolder; @@ -599,11 +598,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, DecimalVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/DurationVector.java b/vector/src/main/java/org/apache/arrow/vector/DurationVector.java index 9ac2921452..817f95d9d5 100644 --- a/vector/src/main/java/org/apache/arrow/vector/DurationVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/DurationVector.java @@ -23,7 +23,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.vector.complex.impl.DurationReaderImpl; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.DurationHolder; import org.apache.arrow.vector.holders.NullableDurationHolder; @@ -410,11 +409,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, DurationVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/FixedSizeBinaryVector.java b/vector/src/main/java/org/apache/arrow/vector/FixedSizeBinaryVector.java index 55dca0bbaa..2005036c78 100644 --- a/vector/src/main/java/org/apache/arrow/vector/FixedSizeBinaryVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/FixedSizeBinaryVector.java @@ -22,7 +22,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; import org.apache.arrow.util.Preconditions; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.FixedSizeBinaryReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.FixedSizeBinaryHolder; @@ -420,11 +419,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, FixedSizeBinaryVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/Float2Vector.java b/vector/src/main/java/org/apache/arrow/vector/Float2Vector.java index daa9b98fbc..021e035d57 100644 --- a/vector/src/main/java/org/apache/arrow/vector/Float2Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/Float2Vector.java @@ -21,7 +21,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.util.Float16; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.Float2ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.Float2Holder; @@ -414,11 +413,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, Float2Vector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java b/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java index 945fb1912e..2b81149204 100644 --- a/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/Float4Vector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.Float4ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.Float4Holder; @@ -351,11 +350,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, Float4Vector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java b/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java index c9b8cb5d58..6758ffde5c 100644 --- a/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/Float8Vector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.Float8ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.Float8Holder; @@ -351,11 +350,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, Float8Vector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/IntVector.java b/vector/src/main/java/org/apache/arrow/vector/IntVector.java index 4de1c8cce3..6058539a2d 100644 --- a/vector/src/main/java/org/apache/arrow/vector/IntVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/IntVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.IntReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.IntHolder; @@ -351,11 +350,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, IntVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java b/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java index a0449d48cb..a0ee849707 100644 --- a/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/IntervalDayVector.java @@ -21,7 +21,6 @@ import java.time.Duration; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.IntervalDayReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.IntervalDayHolder; @@ -434,11 +433,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, IntervalDayVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/IntervalMonthDayNanoVector.java b/vector/src/main/java/org/apache/arrow/vector/IntervalMonthDayNanoVector.java index 48cda236bb..eece3b34b8 100644 --- a/vector/src/main/java/org/apache/arrow/vector/IntervalMonthDayNanoVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/IntervalMonthDayNanoVector.java @@ -22,7 +22,6 @@ import java.time.Period; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.IntervalMonthDayNanoReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.IntervalMonthDayNanoHolder; @@ -431,11 +430,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, IntervalMonthDayNanoVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java b/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java index 74cdc31005..92b46593a3 100644 --- a/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/IntervalYearVector.java @@ -21,7 +21,6 @@ import java.time.Period; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.IntervalYearReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.IntervalYearHolder; @@ -367,11 +366,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, IntervalYearVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/LargeVarBinaryVector.java b/vector/src/main/java/org/apache/arrow/vector/LargeVarBinaryVector.java index c33c3a7eea..fe798494c9 100644 --- a/vector/src/main/java/org/apache/arrow/vector/LargeVarBinaryVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/LargeVarBinaryVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.LargeVarBinaryReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.LargeVarBinaryHolder; @@ -314,11 +313,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, LargeVarBinaryVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/LargeVarCharVector.java b/vector/src/main/java/org/apache/arrow/vector/LargeVarCharVector.java index 4b05330e93..b7a765f310 100644 --- a/vector/src/main/java/org/apache/arrow/vector/LargeVarCharVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/LargeVarCharVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.LargeVarCharReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.LargeVarCharHolder; @@ -351,11 +350,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, LargeVarCharVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/NullVector.java b/vector/src/main/java/org/apache/arrow/vector/NullVector.java index a24d098f90..6bfe540d23 100644 --- a/vector/src/main/java/org/apache/arrow/vector/NullVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/NullVector.java @@ -27,7 +27,6 @@ import org.apache.arrow.memory.util.hash.ArrowBufHasher; import org.apache.arrow.util.Preconditions; import org.apache.arrow.vector.compare.VectorVisitor; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.NullReader; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.ipc.message.ArrowFieldNode; @@ -330,18 +329,6 @@ public void copyFromSafe(int fromIndex, int thisIndex, ValueVector from) { throw new UnsupportedOperationException(); } - @Override - public void copyFrom( - int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException(); - } - - @Override - public void copyFromSafe( - int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException(); - } - @Override public String getName() { return this.getField().getName(); @@ -384,10 +371,5 @@ public void copyValueSafe(int fromIndex, int toIndex) { to.valueCount = toIndex; } } - - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(from, to); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java b/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java index 536bb49d76..c476694797 100644 --- a/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/SmallIntVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.SmallIntReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableSmallIntHolder; @@ -378,11 +377,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, SmallIntVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java b/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java index 75519aeff6..175303bbaf 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TimeMicroVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.TimeMicroReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableTimeMicroHolder; @@ -337,11 +336,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TimeMicroVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java b/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java index 0feeb74899..c9c673cd0a 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TimeMilliVector.java @@ -21,7 +21,6 @@ import java.time.LocalDateTime; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.TimeMilliReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableTimeMilliHolder; @@ -340,11 +339,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TimeMilliVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java b/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java index d0a587f8e6..105d53d25f 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TimeNanoVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.TimeNanoReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableTimeNanoHolder; @@ -337,11 +336,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TimeNanoVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java b/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java index 9356efee1b..1b9dbf9193 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TimeSecVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.TimeSecReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableTimeSecHolder; @@ -337,11 +336,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TimeSecVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java b/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java index 1a7c361e1e..59499581c3 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TimeStampVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.types.pojo.FieldType; import org.apache.arrow.vector.util.TransferPair; @@ -181,11 +180,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TimeStampVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java b/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java index d4e5cdd5fe..022475e5e1 100644 --- a/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/TinyIntVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.TinyIntReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableTinyIntHolder; @@ -378,11 +377,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, TinyIntVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java b/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java index f0558d07c4..83f8d9eeb8 100644 --- a/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/UInt1Vector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UInt1ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableUInt1Holder; @@ -367,11 +366,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, UInt1Vector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java b/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java index cc992568b2..35330f4f91 100644 --- a/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/UInt2Vector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UInt2ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableUInt2Holder; @@ -352,11 +351,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, UInt2Vector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java b/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java index 38876da24b..22e023f6f2 100644 --- a/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/UInt4Vector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UInt4ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableUInt4Holder; @@ -341,11 +340,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, UInt4Vector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java b/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java index 713aa626c7..f026702bb4 100644 --- a/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java +++ b/vector/src/main/java/org/apache/arrow/vector/UInt8Vector.java @@ -21,7 +21,6 @@ import java.math.BigInteger; import org.apache.arrow.memory.ArrowBuf; import org.apache.arrow.memory.BufferAllocator; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UInt8ReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableUInt8Holder; @@ -339,11 +338,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, UInt8Vector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/ValueVector.java b/vector/src/main/java/org/apache/arrow/vector/ValueVector.java index e0628c2ee1..3a5058256c 100644 --- a/vector/src/main/java/org/apache/arrow/vector/ValueVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/ValueVector.java @@ -22,7 +22,6 @@ import org.apache.arrow.memory.OutOfMemoryException; import org.apache.arrow.memory.util.hash.ArrowBufHasher; import org.apache.arrow.vector.compare.VectorVisitor; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.types.Types.MinorType; import org.apache.arrow.vector.types.pojo.Field; @@ -310,30 +309,6 @@ public interface ValueVector extends Closeable, Iterable { */ void copyFromSafe(int fromIndex, int thisIndex, ValueVector from); - /** - * Copy a cell value from a particular index in source vector to a particular position in this - * vector. - * - * @param fromIndex position to copy from in source vector - * @param thisIndex position to copy to in this vector - * @param from source vector - * @param writerFactory the extension type writer factory to use for copying extension type values - */ - void copyFrom( - int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory); - - /** - * Same as {@link #copyFrom(int, int, ValueVector)} except that it handles the case when the - * capacity of the vector needs to be expanded before copy. - * - * @param fromIndex position to copy from in source vector - * @param thisIndex position to copy to in this vector - * @param from source vector - * @param writerFactory the extension type writer factory to use for copying extension type values - */ - void copyFromSafe( - int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory); - /** * Accept a generic {@link VectorVisitor} and return the result. * diff --git a/vector/src/main/java/org/apache/arrow/vector/VarBinaryVector.java b/vector/src/main/java/org/apache/arrow/vector/VarBinaryVector.java index 40c8764007..ad76504f0f 100644 --- a/vector/src/main/java/org/apache/arrow/vector/VarBinaryVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/VarBinaryVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.VarBinaryReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableVarBinaryHolder; @@ -314,11 +313,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, VarBinaryVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/VarCharVector.java b/vector/src/main/java/org/apache/arrow/vector/VarCharVector.java index 1786d81ca6..5ddc8b84d2 100644 --- a/vector/src/main/java/org/apache/arrow/vector/VarCharVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/VarCharVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.VarCharReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableVarCharHolder; @@ -349,11 +348,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, VarCharVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/ViewVarBinaryVector.java b/vector/src/main/java/org/apache/arrow/vector/ViewVarBinaryVector.java index cba2a50f83..c41854bb5f 100644 --- a/vector/src/main/java/org/apache/arrow/vector/ViewVarBinaryVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/ViewVarBinaryVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.ViewVarBinaryReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableViewVarBinaryHolder; @@ -296,11 +295,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, ViewVarBinaryVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/ViewVarCharVector.java b/vector/src/main/java/org/apache/arrow/vector/ViewVarCharVector.java index c985e7df5b..9ce7f85ef6 100644 --- a/vector/src/main/java/org/apache/arrow/vector/ViewVarCharVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/ViewVarCharVector.java @@ -20,7 +20,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.ReusableBuffer; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.ViewVarCharReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.NullableViewVarCharHolder; @@ -344,11 +343,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { to.copyFromSafe(fromIndex, toIndex, ViewVarCharVector.this); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - copyValueSafe(fromIndex, toIndex); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/ZeroVector.java b/vector/src/main/java/org/apache/arrow/vector/ZeroVector.java index 6a5d1bbc8d..c838de60d8 100644 --- a/vector/src/main/java/org/apache/arrow/vector/ZeroVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/ZeroVector.java @@ -19,7 +19,6 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.util.ArrowBufPointer; import org.apache.arrow.memory.util.hash.ArrowBufHasher; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.types.pojo.FieldType; import org.apache.arrow.vector.util.CallBack; @@ -128,8 +127,5 @@ public ValueVector getTo() { @Override public void copyValueSafe(int from, int to) {} - - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) {} }; } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java index 429f9884bb..a6a71cf1a4 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/AbstractContainerVector.java @@ -21,7 +21,6 @@ import org.apache.arrow.vector.DensityAwareVector; import org.apache.arrow.vector.FieldVector; import org.apache.arrow.vector.ValueVector; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.types.Types.MinorType; import org.apache.arrow.vector.types.pojo.ArrowType; import org.apache.arrow.vector.types.pojo.ArrowType.FixedSizeList; @@ -152,18 +151,6 @@ public void copyFromSafe(int fromIndex, int thisIndex, ValueVector from) { throw new UnsupportedOperationException(); } - @Override - public void copyFrom( - int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException(); - } - - @Override - public void copyFromSafe( - int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException(); - } - @Override public String getName() { return name; diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java index 1711385f12..4e6cf5c412 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java @@ -45,7 +45,6 @@ import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.ZeroVector; import org.apache.arrow.vector.compare.VectorVisitor; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UnionFixedSizeListReader; import org.apache.arrow.vector.complex.impl.UnionFixedSizeListWriter; import org.apache.arrow.vector.complex.reader.FieldReader; @@ -653,28 +652,14 @@ public ValueVector getTo() { @Override public void copyValueSafe(int fromIndex, int toIndex) { - allocateAndCopyValueSafe(fromIndex, toIndex, null); - } - - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - allocateAndCopyValueSafe(from, to, writerFactory); - } - - private void allocateAndCopyValueSafe( - int from, int to, ExtensionTypeWriterFactory writerFactory) { - while (to >= this.to.getValueCapacity()) { + while (toIndex >= this.to.getValueCapacity()) { this.to.reAlloc(); } - BitVectorHelper.setValidityBit(this.to.validityBuffer, to, isSet(from)); - int fromOffset = from * listSize; - int toOffset = to * listSize; + BitVectorHelper.setValidityBit(this.to.validityBuffer, toIndex, isSet(fromIndex)); + int fromOffset = fromIndex * listSize; + int toOffset = toIndex * listSize; for (int i = 0; i < listSize; i++) { - if (writerFactory == null) { - dataPair.copyValueSafe(fromOffset + i, toOffset + i); - } else { - dataPair.copyValueSafe(fromOffset + i, toOffset + i, writerFactory); - } + dataPair.copyValueSafe(fromOffset + i, toOffset + i); } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java index f2994c5fe1..997b5a8b78 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListVector.java @@ -49,7 +49,6 @@ import org.apache.arrow.vector.ZeroVector; import org.apache.arrow.vector.compare.VectorVisitor; import org.apache.arrow.vector.complex.impl.ComplexCopier; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UnionLargeListReader; import org.apache.arrow.vector.complex.impl.UnionLargeListWriter; import org.apache.arrow.vector.complex.reader.FieldReader; @@ -483,42 +482,12 @@ public void copyFromSafe(int inIndex, int outIndex, ValueVector from) { */ @Override public void copyFrom(int inIndex, int outIndex, ValueVector from) { - copyFrom(inIndex, outIndex, from, null); - } - - /** - * Copy a cell value from a particular index in source vector to a particular position in this - * vector. - * - * @param inIndex position to copy from in source vector - * @param outIndex position to copy to in this vector - * @param from source vector - * @param writerFactory the extension type writer factory to use for copying extension type values - */ - @Override - public void copyFrom( - int inIndex, int outIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { Preconditions.checkArgument(this.getMinorType() == from.getMinorType()); FieldReader in = from.getReader(); in.setPosition(inIndex); UnionLargeListWriter out = getWriter(); out.setPosition(outIndex); - ComplexCopier.copy(in, out, writerFactory); - } - - /** - * Same as {@link #copyFrom(int, int, ValueVector)} except that it handles the case when the - * capacity of the vector needs to be expanded before copy. - * - * @param inIndex position to copy from in source vector - * @param outIndex position to copy to in this vector - * @param from source vector - * @param writerFactory the extension type writer factory to use for copying extension type values - */ - @Override - public void copyFromSafe( - int inIndex, int outIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - copyFrom(inIndex, outIndex, from, writerFactory); + ComplexCopier.copy(in, out); } /** @@ -731,11 +700,6 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, LargeListVector.this); } - - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - this.to.copyFrom(from, to, LargeListVector.this, writerFactory); - } } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListViewVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListViewVector.java index 107ad035e4..2da7eb057e 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/LargeListViewVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/LargeListViewVector.java @@ -41,7 +41,6 @@ import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.ZeroVector; import org.apache.arrow.vector.compare.VectorVisitor; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UnionLargeListViewReader; import org.apache.arrow.vector.complex.impl.UnionLargeListViewWriter; import org.apache.arrow.vector.complex.impl.UnionListReader; @@ -347,20 +346,6 @@ public void copyFrom(int inIndex, int outIndex, ValueVector from) { "LargeListViewVector does not support copyFrom operation yet."); } - @Override - public void copyFromSafe( - int inIndex, int outIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException( - "LargeListViewVector does not support copyFromSafe operation yet."); - } - - @Override - public void copyFrom( - int inIndex, int outIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - throw new UnsupportedOperationException( - "LargeListViewVector does not support copyFrom operation yet."); - } - @Override public FieldVector getDataVector() { return vector; @@ -552,11 +537,6 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, LargeListViewVector.this); } - - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - this.to.copyFrom(from, to, LargeListViewVector.this, writerFactory); - } } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java index 2730c21883..93a313ef4f 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/ListVector.java @@ -42,7 +42,6 @@ import org.apache.arrow.vector.ZeroVector; import org.apache.arrow.vector.compare.VectorVisitor; import org.apache.arrow.vector.complex.impl.ComplexCopier; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UnionListReader; import org.apache.arrow.vector.complex.impl.UnionListWriter; import org.apache.arrow.vector.complex.reader.FieldReader; @@ -401,42 +400,12 @@ public void copyFromSafe(int inIndex, int outIndex, ValueVector from) { */ @Override public void copyFrom(int inIndex, int outIndex, ValueVector from) { - copyFrom(inIndex, outIndex, from, null); - } - - /** - * Same as {@link #copyFrom(int, int, ValueVector)} except that it handles the case when the - * capacity of the vector needs to be expanded before copy. - * - * @param inIndex position to copy from in source vector - * @param outIndex position to copy to in this vector - * @param from source vector - * @param writerFactory the extension type writer factory to use for copying extension type values - */ - @Override - public void copyFromSafe( - int inIndex, int outIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - copyFrom(inIndex, outIndex, from, writerFactory); - } - - /** - * Copy a cell value from a particular index in source vector to a particular position in this - * vector. - * - * @param inIndex position to copy from in source vector - * @param outIndex position to copy to in this vector - * @param from source vector - * @param writerFactory the extension type writer factory to use for copying extension type values - */ - @Override - public void copyFrom( - int inIndex, int outIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { Preconditions.checkArgument(this.getMinorType() == from.getMinorType()); FieldReader in = from.getReader(); in.setPosition(inIndex); FieldWriter out = getWriter(); out.setPosition(outIndex); - ComplexCopier.copy(in, out, writerFactory); + ComplexCopier.copy(in, out); } /** @@ -612,11 +581,6 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, ListVector.this); } - - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - this.to.copyFrom(from, to, ListVector.this, writerFactory); - } } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java index b8486b4fbd..8711db5e0f 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/ListViewVector.java @@ -42,7 +42,6 @@ import org.apache.arrow.vector.ZeroVector; import org.apache.arrow.vector.compare.VectorVisitor; import org.apache.arrow.vector.complex.impl.ComplexCopier; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UnionListViewReader; import org.apache.arrow.vector.complex.impl.UnionListViewWriter; import org.apache.arrow.vector.complex.reader.FieldReader; @@ -339,12 +338,6 @@ public void copyFromSafe(int inIndex, int outIndex, ValueVector from) { copyFrom(inIndex, outIndex, from); } - @Override - public void copyFromSafe( - int inIndex, int outIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - copyFrom(inIndex, outIndex, from, writerFactory); - } - @Override public OUT accept(VectorVisitor visitor, IN value) { return visitor.visit(this, value); @@ -352,18 +345,12 @@ public OUT accept(VectorVisitor visitor, IN value) { @Override public void copyFrom(int inIndex, int outIndex, ValueVector from) { - copyFrom(inIndex, outIndex, from, null); - } - - @Override - public void copyFrom( - int inIndex, int outIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { Preconditions.checkArgument(this.getMinorType() == from.getMinorType()); FieldReader in = from.getReader(); in.setPosition(inIndex); FieldWriter out = getWriter(); out.setPosition(outIndex); - ComplexCopier.copy(in, out, writerFactory); + ComplexCopier.copy(in, out); } @Override @@ -557,11 +544,6 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, ListViewVector.this); } - - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - this.to.copyFrom(from, to, ListViewVector.this, writerFactory); - } } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java index 8927c6faef..3f98322ba9 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/MapVector.java @@ -25,7 +25,6 @@ import org.apache.arrow.vector.FieldVector; import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.ZeroVector; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UnionMapReader; import org.apache.arrow.vector.complex.impl.UnionMapWriter; import org.apache.arrow.vector.types.Types; @@ -241,10 +240,5 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, MapVector.this); } - - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - this.to.copyFrom(from, to, MapVector.this, writerFactory); - } } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java index 5c4373347d..5a215608ef 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/NonNullableStructVector.java @@ -31,7 +31,6 @@ import org.apache.arrow.vector.ValueIterableVector; import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.compare.VectorVisitor; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.SingleStructReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holders.ComplexHolder; @@ -158,27 +157,11 @@ public void copyFrom(int fromIndex, int thisIndex, ValueVector from) { ephPair.copyValueSafe(fromIndex, thisIndex); } - @Override - public void copyFrom( - int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - Preconditions.checkArgument(this.getMinorType() == from.getMinorType()); - if (ephPair == null || ephPair.from != from) { - ephPair = (StructTransferPair) from.makeTransferPair(this); - } - ephPair.copyValueSafe(fromIndex, thisIndex, writerFactory); - } - @Override public void copyFromSafe(int fromIndex, int thisIndex, ValueVector from) { copyFrom(fromIndex, thisIndex, from); } - @Override - public void copyFromSafe( - int fromIndex, int thisIndex, ValueVector from, ExtensionTypeWriterFactory writerFactory) { - copyFrom(fromIndex, thisIndex, from, writerFactory); - } - @Override protected boolean supportsDirectRead() { return true; @@ -375,13 +358,6 @@ public void copyValueSafe(int from, int to) { } } - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - for (TransferPair p : pairs) { - p.copyValueSafe(from, to, writerFactory); - } - } - @Override public void splitAndTransfer(int startIndex, int length) { for (TransferPair p : pairs) { diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/RunEndEncodedVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/RunEndEncodedVector.java index 69fa8a2f70..b83e13449a 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/RunEndEncodedVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/RunEndEncodedVector.java @@ -39,7 +39,6 @@ import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.ZeroVector; import org.apache.arrow.vector.compare.VectorVisitor; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.complex.writer.FieldWriter; import org.apache.arrow.vector.ipc.message.ArrowFieldNode; @@ -454,11 +453,6 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, RunEndEncodedVector.this); } - - @Override - public void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory) { - this.to.copyFrom(from, to, RunEndEncodedVector.this, writerFactory); - } } /** diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java index 1334699487..17d587b518 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java @@ -36,7 +36,6 @@ import org.apache.arrow.vector.FieldVector; import org.apache.arrow.vector.ValueIterableVector; import org.apache.arrow.vector.ValueVector; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.NullableStructReaderImpl; import org.apache.arrow.vector.complex.impl.NullableStructWriter; import org.apache.arrow.vector.holders.ComplexHolder; @@ -297,13 +296,6 @@ public void copyValueSafe(int fromIndex, int toIndex) { super.copyValueSafe(fromIndex, toIndex); } - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - reallocateTargetValidityBuffer(fromIndex, toIndex); - super.copyValueSafe(fromIndex, toIndex, writerFactory); - } - @Override public void splitAndTransfer(int startIndex, int length) { Preconditions.checkArgument( diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/impl/AbstractBaseReader.java b/vector/src/main/java/org/apache/arrow/vector/complex/impl/AbstractBaseReader.java index bf074ecb90..64c1f836c2 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/impl/AbstractBaseReader.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/impl/AbstractBaseReader.java @@ -117,12 +117,7 @@ public void copyAsValue(MapWriter writer) { } @Override - public void copyAsValue(ListWriter writer, ExtensionTypeWriterFactory writerFactory) { - ComplexCopier.copy(this, (FieldWriter) writer, writerFactory); - } - - @Override - public void copyAsValue(MapWriter writer, ExtensionTypeWriterFactory writerFactory) { - ComplexCopier.copy(this, (FieldWriter) writer, writerFactory); + public ExtensionTypeWriterFactory getExtensionTypeWriterFactory() { + throw new IllegalStateException("The current reader doesn't support reading extension type"); } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionLargeListReader.java b/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionLargeListReader.java index a9104cb0d2..be236c3166 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionLargeListReader.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionLargeListReader.java @@ -105,8 +105,4 @@ public boolean next() { public void copyAsValue(UnionLargeListWriter writer) { ComplexCopier.copy(this, (FieldWriter) writer); } - - public void copyAsValue(UnionLargeListWriter writer, ExtensionTypeWriterFactory writerFactory) { - ComplexCopier.copy(this, (FieldWriter) writer, writerFactory); - } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java b/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java index 1ba7b27156..ba59717974 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java @@ -16,6 +16,7 @@ */ package org.apache.arrow.vector.complex.reader; +import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.holders.ExtensionHolder; /** Interface for reading extension types. Extends the functionality of {@link BaseReader}. */ @@ -41,4 +42,6 @@ public interface ExtensionReader extends BaseReader { * @return true if the value is set, false otherwise */ boolean isSet(); + + ExtensionTypeWriterFactory getExtensionTypeWriterFactory(); } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/reader/FieldReader.java b/vector/src/main/java/org/apache/arrow/vector/complex/reader/FieldReader.java index a42d9404f4..e352e4551f 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/reader/FieldReader.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/reader/FieldReader.java @@ -16,6 +16,7 @@ */ package org.apache.arrow.vector.complex.reader; +// import org.apache.arrow.vector.complex.reader.BaseReader.ExtensionReader; import org.apache.arrow.vector.complex.reader.BaseReader.ListReader; import org.apache.arrow.vector.complex.reader.BaseReader.MapReader; import org.apache.arrow.vector.complex.reader.BaseReader.RepeatedListReader; diff --git a/vector/src/main/java/org/apache/arrow/vector/util/TransferPair.java b/vector/src/main/java/org/apache/arrow/vector/util/TransferPair.java index 494a2da3a2..aca685bacc 100644 --- a/vector/src/main/java/org/apache/arrow/vector/util/TransferPair.java +++ b/vector/src/main/java/org/apache/arrow/vector/util/TransferPair.java @@ -17,7 +17,6 @@ package org.apache.arrow.vector.util; import org.apache.arrow.vector.ValueVector; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; /** Interface for copying values between a pair of two vectors of the same type. */ public interface TransferPair { @@ -28,6 +27,4 @@ public interface TransferPair { ValueVector getTo(); void copyValueSafe(int from, int to); - - void copyValueSafe(int from, int to, ExtensionTypeWriterFactory writerFactory); } diff --git a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java index 0885980dbf..ad1a90642e 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java @@ -1064,8 +1064,8 @@ public void testCopyValueSafeForExtensionType() throws Exception { // This internally calls TransferImpl.copyValueSafe with ExtensionTypeWriterFactory outVector.allocateNew(); TransferPair tp = inVector.makeTransferPair(outVector); - tp.copyValueSafe(0, 0, new UuidWriterFactory()); - tp.copyValueSafe(1, 1, new UuidWriterFactory()); + tp.copyValueSafe(0, 0); + tp.copyValueSafe(1, 1); outVector.setValueCount(2); // Verify first list diff --git a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java index 92f484493f..fe1829dd09 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java @@ -1292,7 +1292,7 @@ public void testCopyFromForExtensionType() throws Exception { // copy values from input to output outVector.allocateNew(); - outVector.copyFrom(0, 0, inVector, new UuidWriterFactory()); + outVector.copyFrom(0, 0, inVector); outVector.setValueCount(1); UnionListReader reader = outVector.getReader(); @@ -1350,8 +1350,8 @@ public void testCopyValueSafeForExtensionType() throws Exception { // This tests the new makeTransferPair API with writerFactory parameter outVector.allocateNew(); TransferPair transferPair = inVector.makeTransferPair(outVector); - transferPair.copyValueSafe(0, 0, new UuidWriterFactory()); - transferPair.copyValueSafe(1, 1, new UuidWriterFactory()); + transferPair.copyValueSafe(0, 0); + transferPair.copyValueSafe(1, 1); outVector.setValueCount(2); // Verify first list diff --git a/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java b/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java index 8605d250fd..9bcb00df79 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java @@ -1342,7 +1342,7 @@ public void testCopyFromForExtensionType() throws Exception { writer.setValueCount(1); outVector.allocateNew(); - outVector.copyFrom(0, 0, inVector, new UuidWriterFactory()); + outVector.copyFrom(0, 0, inVector); outVector.setValueCount(1); UnionMapReader mapReader = outVector.getReader(); diff --git a/vector/src/test/java/org/apache/arrow/vector/UuidVector.java b/vector/src/test/java/org/apache/arrow/vector/UuidVector.java index a5743f0d17..72ba4aa555 100644 --- a/vector/src/test/java/org/apache/arrow/vector/UuidVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/UuidVector.java @@ -20,7 +20,6 @@ import java.util.UUID; import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.memory.util.hash.ArrowBufHasher; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.complex.impl.UuidReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.holder.UuidHolder; @@ -124,11 +123,5 @@ public void splitAndTransfer(int startIndex, int length) { public void copyValueSafe(int fromIndex, int toIndex) { tp.copyValueSafe(fromIndex, toIndex); } - - @Override - public void copyValueSafe( - int fromIndex, int toIndex, ExtensionTypeWriterFactory writerFactory) { - tp.copyValueSafe(fromIndex, toIndex, writerFactory); - } } } diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java b/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java index 738e8905e3..51a3ff5965 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java +++ b/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java @@ -874,7 +874,7 @@ public void testCopyListVectorWithExtensionType() { for (int i = 0; i < COUNT; i++) { in.setPosition(i); out.setPosition(i); - ComplexCopier.copy(in, out, new UuidWriterFactory()); + ComplexCopier.copy(in, out); } to.setValueCount(COUNT); @@ -914,7 +914,7 @@ public void testCopyMapVectorWithExtensionType() { for (int i = 0; i < COUNT; i++) { in.setPosition(i); out.setPosition(i); - ComplexCopier.copy(in, out, new UuidWriterFactory()); + ComplexCopier.copy(in, out); } to.setValueCount(COUNT); @@ -951,7 +951,7 @@ public void testCopyStructVectorWithExtensionType() { for (int i = 0; i < COUNT; i++) { in.setPosition(i); out.setPosition(i); - ComplexCopier.copy(in, out, new UuidWriterFactory()); + ComplexCopier.copy(in, out); } to.setValueCount(COUNT); diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidReaderImpl.java b/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidReaderImpl.java index 6b98d3b340..06a389ced0 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidReaderImpl.java +++ b/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidReaderImpl.java @@ -66,4 +66,9 @@ public void copyAsValue(AbstractExtensionTypeWriter writer) { public Object readObject() { return vector.getObject(idx()); } + + @Override + public ExtensionTypeWriterFactory getExtensionTypeWriterFactory() { + return new UuidWriterFactory(); + } } From 285cbd8f6b3b0135d477ce1da76282de9dd70c72 Mon Sep 17 00:00:00 2001 From: jhrotko Date: Thu, 30 Oct 2025 09:23:51 +0000 Subject: [PATCH 05/12] Clean up --- .../src/main/codegen/templates/DenseUnionVector.java | 1 - vector/src/main/codegen/templates/UnionVector.java | 1 - .../arrow/vector/complex/FixedSizeListVector.java | 6 +++--- .../apache/arrow/vector/complex/StructVector.java | 12 ++++-------- .../arrow/vector/complex/reader/FieldReader.java | 1 - 5 files changed, 7 insertions(+), 14 deletions(-) diff --git a/vector/src/main/codegen/templates/DenseUnionVector.java b/vector/src/main/codegen/templates/DenseUnionVector.java index fb8486fbd3..e9a9a2878b 100644 --- a/vector/src/main/codegen/templates/DenseUnionVector.java +++ b/vector/src/main/codegen/templates/DenseUnionVector.java @@ -707,7 +707,6 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, DenseUnionVector.this); } - } @Override diff --git a/vector/src/main/codegen/templates/UnionVector.java b/vector/src/main/codegen/templates/UnionVector.java index 2a32842b0e..67efdf60f7 100644 --- a/vector/src/main/codegen/templates/UnionVector.java +++ b/vector/src/main/codegen/templates/UnionVector.java @@ -620,7 +620,6 @@ public ValueVector getTo() { public void copyValueSafe(int from, int to) { this.to.copyFrom(from, to, UnionVector.this); } - } @Override diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java index 4e6cf5c412..e3b4ab477f 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/FixedSizeListVector.java @@ -652,10 +652,10 @@ public ValueVector getTo() { @Override public void copyValueSafe(int fromIndex, int toIndex) { - while (toIndex >= this.to.getValueCapacity()) { - this.to.reAlloc(); + while (toIndex >= to.getValueCapacity()) { + to.reAlloc(); } - BitVectorHelper.setValidityBit(this.to.validityBuffer, toIndex, isSet(fromIndex)); + BitVectorHelper.setValidityBit(to.validityBuffer, toIndex, isSet(fromIndex)); int fromOffset = fromIndex * listSize; int toOffset = toIndex * listSize; for (int i = 0; i < listSize; i++) { diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java index 17d587b518..26d03b5278 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java @@ -292,7 +292,10 @@ public void transfer() { @Override public void copyValueSafe(int fromIndex, int toIndex) { - reallocateTargetValidityBuffer(fromIndex, toIndex); + while (toIndex >= this.target.getValidityBufferValueCapacity()) { + target.reallocValidityBuffer(); + } + BitVectorHelper.setValidityBit(target.validityBuffer, toIndex, isSet(fromIndex)); super.copyValueSafe(fromIndex, toIndex); } @@ -308,13 +311,6 @@ public void splitAndTransfer(int startIndex, int length) { splitAndTransferValidityBuffer(startIndex, length, target); super.splitAndTransfer(startIndex, length); } - - private void reallocateTargetValidityBuffer(int fromIndex, int toIndex) { - while (toIndex >= this.target.getValidityBufferValueCapacity()) { - target.reallocValidityBuffer(); - } - BitVectorHelper.setValidityBit(target.validityBuffer, toIndex, isSet(fromIndex)); - } } /* diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/reader/FieldReader.java b/vector/src/main/java/org/apache/arrow/vector/complex/reader/FieldReader.java index e352e4551f..a42d9404f4 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/reader/FieldReader.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/reader/FieldReader.java @@ -16,7 +16,6 @@ */ package org.apache.arrow.vector.complex.reader; -// import org.apache.arrow.vector.complex.reader.BaseReader.ExtensionReader; import org.apache.arrow.vector.complex.reader.BaseReader.ListReader; import org.apache.arrow.vector.complex.reader.BaseReader.MapReader; import org.apache.arrow.vector.complex.reader.BaseReader.RepeatedListReader; From 9acf2740d8775a8dc617299d14d7beed72742276 Mon Sep 17 00:00:00 2001 From: jhrotko Date: Thu, 30 Oct 2025 09:57:58 +0000 Subject: [PATCH 06/12] remove writeValue from ComplexCopier --- .../src/main/codegen/templates/ComplexCopier.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/vector/src/main/codegen/templates/ComplexCopier.java b/vector/src/main/codegen/templates/ComplexCopier.java index 9b064f733a..b95e0c42d0 100644 --- a/vector/src/main/codegen/templates/ComplexCopier.java +++ b/vector/src/main/codegen/templates/ComplexCopier.java @@ -41,11 +41,8 @@ public class ComplexCopier { * @param input field to read from * @param output field to write to */ - public static void copy(FieldReader input, FieldWriter output) { - writeValue(input, output); - } + public static void copy(FieldReader reader, FieldWriter writer) { - private static void writeValue(FieldReader reader, FieldWriter writer) { final MinorType mt = reader.getMinorType(); switch (mt) { @@ -61,7 +58,7 @@ private static void writeValue(FieldReader reader, FieldWriter writer) { FieldReader childReader = reader.reader(); FieldWriter childWriter = getListWriterForReader(childReader, writer); if (childReader.isSet()) { - writeValue(childReader, childWriter); + copy(childReader, childWriter); } else { childWriter.writeNull(); } @@ -79,8 +76,8 @@ private static void writeValue(FieldReader reader, FieldWriter writer) { FieldReader structReader = reader.reader(); if (structReader.isSet()) { writer.startEntry(); - writeValue(mapReader.key(), getMapWriterForReader(mapReader.key(), writer.key())); - writeValue(mapReader.value(), getMapWriterForReader(mapReader.value(), writer.value())); + copy(mapReader.key(), getMapWriterForReader(mapReader.key(), writer.key())); + copy(mapReader.value(), getMapWriterForReader(mapReader.value(), writer.value())); writer.endEntry(); } else { writer.writeNull(); @@ -99,7 +96,7 @@ private static void writeValue(FieldReader reader, FieldWriter writer) { if (childReader.getMinorType() != Types.MinorType.NULL) { FieldWriter childWriter = getStructWriterForReader(childReader, writer, name); if (childReader.isSet()) { - writeValue(childReader, childWriter); + copy(childReader, childWriter); } else { childWriter.writeNull(); } From d62f42395ac6de1d18ada8bee154b5fa68006ad3 Mon Sep 17 00:00:00 2001 From: jhrotko Date: Thu, 30 Oct 2025 10:01:55 +0000 Subject: [PATCH 07/12] Add javadoc --- .../arrow/vector/complex/reader/ExtensionReader.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java b/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java index ba59717974..406e080d1d 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java @@ -43,5 +43,14 @@ public interface ExtensionReader extends BaseReader { */ boolean isSet(); + /** + * Gets the extension type writer factory associated with this reader. + * + *

The writer factory is used to create appropriate writers when copying extension type values + * to another vector. This allows the copy operation to preserve the extension type semantics. + * + * @return the extension type writer factory + * @throws IllegalStateException if the reader doesn't support extension types + */ ExtensionTypeWriterFactory getExtensionTypeWriterFactory(); } From 046fc1fe8064b94414226de3a286a7237de2c993 Mon Sep 17 00:00:00 2001 From: jhrotko Date: Thu, 30 Oct 2025 19:27:06 +0000 Subject: [PATCH 08/12] Revert small change --- .../main/java/org/apache/arrow/vector/complex/StructVector.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java b/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java index 26d03b5278..5e5bb7fc21 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/StructVector.java @@ -292,7 +292,7 @@ public void transfer() { @Override public void copyValueSafe(int fromIndex, int toIndex) { - while (toIndex >= this.target.getValidityBufferValueCapacity()) { + while (toIndex >= target.getValidityBufferValueCapacity()) { target.reallocValidityBuffer(); } BitVectorHelper.setValidityBit(target.validityBuffer, toIndex, isSet(fromIndex)); From 6cb9a1d52e758647e3446bb03e9e591af4df413e Mon Sep 17 00:00:00 2001 From: jhrotko Date: Thu, 6 Nov 2025 17:59:16 +0000 Subject: [PATCH 09/12] Refactor extension type factory --- .../templates/AbstractFieldReader.java | 5 --- .../templates/AbstractFieldWriter.java | 5 +-- .../src/main/codegen/templates/ArrowType.java | 4 ++ .../main/codegen/templates/BaseWriter.java | 7 ---- .../main/codegen/templates/ComplexCopier.java | 2 - .../main/codegen/templates/NullReader.java | 1 - .../codegen/templates/PromotableWriter.java | 24 ++++++++---- .../codegen/templates/UnionListWriter.java | 13 ++----- .../main/codegen/templates/UnionReader.java | 23 +++++++++++ .../main/codegen/templates/UnionVector.java | 18 +++++++++ .../main/codegen/templates/UnionWriter.java | 27 ++++++++++++- .../complex/impl/AbstractBaseReader.java | 5 --- .../impl/ExtensionTypeWriterFactory.java | 38 ------------------- .../complex/impl/UnionExtensionWriter.java | 14 +------ .../complex/reader/ExtensionReader.java | 12 ------ .../arrow/vector/extension/OpaqueType.java | 7 ++++ .../arrow/vector/holders/ExtensionHolder.java | 4 ++ .../arrow/vector/TestLargeListVector.java | 7 +--- .../apache/arrow/vector/TestListVector.java | 26 +++++-------- .../apache/arrow/vector/TestMapVector.java | 13 ++----- .../apache/arrow/vector/TestStructVector.java | 10 ++++- .../org/apache/arrow/vector/UuidVector.java | 6 +++ .../complex/impl/TestComplexCopier.java | 15 +++----- .../complex/impl/TestPromotableWriter.java | 34 +++++++++++++---- .../vector/complex/impl/UuidReaderImpl.java | 19 ++++++---- .../complex/writer/TestComplexWriter.java | 24 ++++++++++-- .../NullableUuidHolder.java} | 17 ++++----- .../arrow/vector/holder/UuidHolder.java | 7 ++++ .../vector/types/pojo/TestExtensionType.java | 7 ++++ .../arrow/vector/types/pojo/UuidType.java | 9 +++++ 30 files changed, 233 insertions(+), 170 deletions(-) delete mode 100644 vector/src/main/java/org/apache/arrow/vector/complex/impl/ExtensionTypeWriterFactory.java rename vector/src/test/java/org/apache/arrow/vector/{complex/impl/UuidWriterFactory.java => holder/NullableUuidHolder.java} (65%) diff --git a/vector/src/main/codegen/templates/AbstractFieldReader.java b/vector/src/main/codegen/templates/AbstractFieldReader.java index efb87c71dc..556fb576ce 100644 --- a/vector/src/main/codegen/templates/AbstractFieldReader.java +++ b/vector/src/main/codegen/templates/AbstractFieldReader.java @@ -140,11 +140,6 @@ public int size() { return -1; } - @Override - public ExtensionTypeWriterFactory getExtensionTypeWriterFactory() { - throw new IllegalStateException("The current reader doesn't support reading extension type"); - } - private void fail(String name) { throw new IllegalArgumentException(String.format("You tried to read a [%s] type when you are using a field reader of type [%s].", name, this.getClass().getSimpleName())); } diff --git a/vector/src/main/codegen/templates/AbstractFieldWriter.java b/vector/src/main/codegen/templates/AbstractFieldWriter.java index ae5b97faef..bcdc5c5302 100644 --- a/vector/src/main/codegen/templates/AbstractFieldWriter.java +++ b/vector/src/main/codegen/templates/AbstractFieldWriter.java @@ -107,15 +107,14 @@ public void endEntry() { throw new IllegalStateException(String.format("You tried to end a map entry when you are using a ValueWriter of type %s.", this.getClass().getSimpleName())); } + @Override public void write(ExtensionHolder var1) { this.fail("ExtensionType"); } + @Override public void writeExtension(Object var1) { this.fail("ExtensionType"); } - public void addExtensionTypeWriterFactory(ExtensionTypeWriterFactory var1) { - this.fail("ExtensionType"); - } <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first /> <#assign fields = minor.fields!type.fields /> diff --git a/vector/src/main/codegen/templates/ArrowType.java b/vector/src/main/codegen/templates/ArrowType.java index fd35c1cd2b..5daf57c3d3 100644 --- a/vector/src/main/codegen/templates/ArrowType.java +++ b/vector/src/main/codegen/templates/ArrowType.java @@ -27,8 +27,10 @@ import org.apache.arrow.flatbuf.Type; import org.apache.arrow.memory.BufferAllocator; +import org.apache.arrow.vector.complex.writer.FieldWriter; import org.apache.arrow.vector.types.*; import org.apache.arrow.vector.FieldVector; +import org.apache.arrow.vector.ValueVector; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; @@ -331,6 +333,8 @@ public boolean equals(Object obj) { public T accept(ArrowTypeVisitor visitor) { return visitor.visit(this); } + + public abstract FieldWriter getNewFieldWriter(ValueVector vector); } private static final int defaultDecimalBitWidth = 128; diff --git a/vector/src/main/codegen/templates/BaseWriter.java b/vector/src/main/codegen/templates/BaseWriter.java index 78da7fddc3..e5333ef292 100644 --- a/vector/src/main/codegen/templates/BaseWriter.java +++ b/vector/src/main/codegen/templates/BaseWriter.java @@ -123,13 +123,6 @@ public interface ExtensionWriter extends BaseWriter { * @param value the extension type value to write */ void writeExtension(Object value); - - /** - * Adds the given extension type factory. This factory allows configuring writer implementations for specific ExtensionTypeVector. - * - * @param factory the extension type factory to add - */ - void addExtensionTypeWriterFactory(ExtensionTypeWriterFactory factory); } public interface ScalarWriter extends diff --git a/vector/src/main/codegen/templates/ComplexCopier.java b/vector/src/main/codegen/templates/ComplexCopier.java index b95e0c42d0..b6449e0e94 100644 --- a/vector/src/main/codegen/templates/ComplexCopier.java +++ b/vector/src/main/codegen/templates/ComplexCopier.java @@ -111,8 +111,6 @@ public static void copy(FieldReader reader, FieldWriter writer) { if (reader.isSet()) { Object value = reader.readObject(); if (value != null) { - ExtensionTypeWriterFactory writerFactory = reader.getExtensionTypeWriterFactory(); - writer.addExtensionTypeWriterFactory(writerFactory); writer.writeExtension(value); } } else { diff --git a/vector/src/main/codegen/templates/NullReader.java b/vector/src/main/codegen/templates/NullReader.java index 0529633478..88e6ea98ea 100644 --- a/vector/src/main/codegen/templates/NullReader.java +++ b/vector/src/main/codegen/templates/NullReader.java @@ -86,7 +86,6 @@ public void read(int arrayIndex, Nullable${name}Holder holder){ } - public void copyAsValue(StructWriter writer, ExtensionTypeWriterFactory writerFactory){} public void read(ExtensionHolder holder) { holder.isSet = 0; } diff --git a/vector/src/main/codegen/templates/PromotableWriter.java b/vector/src/main/codegen/templates/PromotableWriter.java index d22eb00b2c..83e6b39c55 100644 --- a/vector/src/main/codegen/templates/PromotableWriter.java +++ b/vector/src/main/codegen/templates/PromotableWriter.java @@ -286,7 +286,7 @@ protected void setWriter(ValueVector v) { writer = new UnionWriter((UnionVector) vector, nullableStructWriterFactory); break; case EXTENSIONTYPE: - writer = new UnionExtensionWriter((ExtensionTypeVector) vector); + writer = ((ExtensionType) vector.getField().getType()).getNewFieldWriter(vector); break; default: writer = type.getNewFieldWriter(vector); @@ -325,6 +325,9 @@ protected boolean requiresArrowType(MinorType type) { @Override protected FieldWriter getWriter(MinorType type, ArrowType arrowType) { + if(type == MinorType.EXTENSIONTYPE) { + lastExtensionType = arrowType; + } if (state == State.UNION) { if (requiresArrowType(type)) { ((UnionWriter) writer).getWriter(type, arrowType); @@ -540,18 +543,25 @@ public void writeLargeVarChar(String value) { getWriter(MinorType.LARGEVARCHAR).writeLargeVarChar(value); } + protected ArrowType lastExtensionType; + @Override public void writeExtension(Object value) { - getWriter(MinorType.EXTENSIONTYPE).writeExtension(value); + FieldWriter writer = getWriter(MinorType.EXTENSIONTYPE, lastExtensionType); + if(writer instanceof UnionWriter) { + ((UnionWriter) writer).writeExtension(value, lastExtensionType); + } else { + writer.writeExtension(value); + } } - @Override - public void addExtensionTypeWriterFactory(ExtensionTypeWriterFactory factory) { - getWriter(MinorType.EXTENSIONTYPE).addExtensionTypeWriterFactory(factory); + public void writeExtension(Object value, ArrowType arrowType) { + getWriter(MinorType.EXTENSIONTYPE, arrowType).writeExtension(value); } - public void addExtensionTypeWriterFactory(ExtensionTypeWriterFactory factory, ArrowType arrowType) { - getWriter(MinorType.EXTENSIONTYPE, arrowType).addExtensionTypeWriterFactory(factory); + @Override + public void write(ExtensionHolder holder) { + getWriter(MinorType.EXTENSIONTYPE, lastExtensionType).write(holder); } @Override diff --git a/vector/src/main/codegen/templates/UnionListWriter.java b/vector/src/main/codegen/templates/UnionListWriter.java index 3c41ac72b6..a01d6ece30 100644 --- a/vector/src/main/codegen/templates/UnionListWriter.java +++ b/vector/src/main/codegen/templates/UnionListWriter.java @@ -204,13 +204,13 @@ public MapWriter map(String name, boolean keysSorted) { @Override public ExtensionWriter extension(ArrowType arrowType) { - this.extensionType = arrowType; + extensionType = arrowType; return this; } + @Override public ExtensionWriter extension(String name, ArrowType arrowType) { - ExtensionWriter extensionWriter = writer.extension(name, arrowType); - return extensionWriter; + return writer.extension(name, arrowType); } <#if listName == "LargeList"> @@ -337,15 +337,10 @@ public void writeNull() { @Override public void writeExtension(Object value) { - writer.writeExtension(value); + writer.writeExtension(value, extensionType); writer.setPosition(writer.idx() + 1); } - @Override - public void addExtensionTypeWriterFactory(ExtensionTypeWriterFactory var1) { - writer.addExtensionTypeWriterFactory(var1, extensionType); - } - public void write(ExtensionHolder var1) { writer.write(var1); writer.setPosition(writer.idx() + 1); diff --git a/vector/src/main/codegen/templates/UnionReader.java b/vector/src/main/codegen/templates/UnionReader.java index 96ad3e1b9b..0edae7ade0 100644 --- a/vector/src/main/codegen/templates/UnionReader.java +++ b/vector/src/main/codegen/templates/UnionReader.java @@ -79,6 +79,10 @@ public void read(int index, UnionHolder holder) { } private FieldReader getReaderForIndex(int index) { + return getReaderForIndex(index, null); + } + + private FieldReader getReaderForIndex(int index, ArrowType type) { int typeValue = data.getTypeValue(index); FieldReader reader = (FieldReader) readers[typeValue]; if (reader != null) { @@ -105,11 +109,26 @@ private FieldReader getReaderForIndex(int index) { + case EXTENSIONTYPE: + if(type == null) { + throw new RuntimeException("Cannot get Extension reader without an ArrowType"); + } + return (FieldReader) getExtension(type); default: throw new UnsupportedOperationException("Unsupported type: " + MinorType.values()[typeValue]); } } + private ExtensionReader extensionReader; + + private ExtensionReader getExtension(ArrowType type) { + if (extensionReader == null) { + extensionReader = data.getExtension(type).getReader(); + extensionReader.setPosition(idx()); + } + return extensionReader; + } + private SingleStructReaderImpl structReader; private StructReader getStruct() { @@ -240,4 +259,8 @@ public FieldReader reader() { public boolean next() { return getReaderForIndex(idx()).next(); } + + public void read(ExtensionHolder holder){ + getReaderForIndex(idx(), holder.type()).read(holder); + } } diff --git a/vector/src/main/codegen/templates/UnionVector.java b/vector/src/main/codegen/templates/UnionVector.java index 67efdf60f7..c706591966 100644 --- a/vector/src/main/codegen/templates/UnionVector.java +++ b/vector/src/main/codegen/templates/UnionVector.java @@ -379,6 +379,22 @@ public MapVector getMap(String name, ArrowType arrowType) { return mapVector; } + private ExtensionTypeVector extensionVector; + + public ExtensionTypeVector getExtension(ArrowType arrowType) { + if (extensionVector == null) { + int vectorCount = internalStruct.size(); + extensionVector = addOrGet(null, MinorType.EXTENSIONTYPE, arrowType, ExtensionTypeVector.class); + if (internalStruct.size() > vectorCount) { + extensionVector.allocateNew(); + if (callBack != null) { + callBack.doWork(); + } + } + } + return extensionVector; + } + public int getTypeValue(int index) { return typeBuffer.getByte(index * TYPE_WIDTH); } @@ -725,6 +741,8 @@ public ValueVector getVectorByType(int typeId, ArrowType arrowType) { return getListView(); case MAP: return getMap(name, arrowType); + case EXTENSIONTYPE: + return getExtension(arrowType); default: throw new UnsupportedOperationException("Cannot support type: " + MinorType.values()[typeId]); } diff --git a/vector/src/main/codegen/templates/UnionWriter.java b/vector/src/main/codegen/templates/UnionWriter.java index 272edab17c..0db699fd8c 100644 --- a/vector/src/main/codegen/templates/UnionWriter.java +++ b/vector/src/main/codegen/templates/UnionWriter.java @@ -28,6 +28,8 @@ package org.apache.arrow.vector.complex.impl; <#include "/@includes/vv_imports.ftl" /> +import java.util.HashMap; + import org.apache.arrow.vector.complex.writer.BaseWriter; import org.apache.arrow.vector.types.Types.MinorType; @@ -213,8 +215,31 @@ public MapWriter asMap(ArrowType arrowType) { return getMapWriter(arrowType); } + private java.util.Map extensionWriters = new HashMap<>(); + private ExtensionWriter getExtensionWriter(ArrowType arrowType) { - throw new UnsupportedOperationException("ExtensionTypes are not supported yet."); + ExtensionWriter w = extensionWriters.get(arrowType); + if (w == null) { + w = ((ExtensionType) arrowType).getNewFieldWriter(data.getExtension(arrowType)); + w.setPosition(idx()); + extensionWriters.put(arrowType, w); + } + return w; + } + + public void writeExtension(Object value, ArrowType type) { + data.setType(idx(), MinorType.EXTENSIONTYPE); + ExtensionWriter w = getExtensionWriter(type); + w.setPosition(idx()); + w.writeExtension(value); + } + + @Override + public void write(ExtensionHolder holder) { + data.setType(idx(), MinorType.EXTENSIONTYPE); + ExtensionWriter w = getExtensionWriter(holder.type()); + w.setPosition(idx()); + w.write(holder); } BaseWriter getWriter(MinorType minorType) { diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/impl/AbstractBaseReader.java b/vector/src/main/java/org/apache/arrow/vector/complex/impl/AbstractBaseReader.java index 64c1f836c2..b2e95663f7 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/impl/AbstractBaseReader.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/impl/AbstractBaseReader.java @@ -115,9 +115,4 @@ public void copyAsValue(ListWriter writer) { public void copyAsValue(MapWriter writer) { ComplexCopier.copy(this, (FieldWriter) writer); } - - @Override - public ExtensionTypeWriterFactory getExtensionTypeWriterFactory() { - throw new IllegalStateException("The current reader doesn't support reading extension type"); - } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/impl/ExtensionTypeWriterFactory.java b/vector/src/main/java/org/apache/arrow/vector/complex/impl/ExtensionTypeWriterFactory.java deleted file mode 100644 index 09f0314c5f..0000000000 --- a/vector/src/main/java/org/apache/arrow/vector/complex/impl/ExtensionTypeWriterFactory.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.arrow.vector.complex.impl; - -import org.apache.arrow.vector.ExtensionTypeVector; -import org.apache.arrow.vector.complex.writer.FieldWriter; - -/** - * A factory interface for creating instances of {@link ExtensionTypeWriter}. This factory allows - * configuring writer implementations for specific {@link ExtensionTypeVector}. - * - * @param the type of writer implementation for a specific {@link ExtensionTypeVector}. - */ -public interface ExtensionTypeWriterFactory { - - /** - * Returns an instance of the writer implementation for the given {@link ExtensionTypeVector}. - * - * @param vector the {@link ExtensionTypeVector} for which the writer implementation is to be - * returned. - * @return an instance of the writer implementation for the given {@link ExtensionTypeVector}. - */ - T getWriterImpl(ExtensionTypeVector vector); -} diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java b/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java index d288c3b1c8..52e63306d8 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java @@ -59,12 +59,6 @@ public void writeExtension(Object var1) { this.writer.writeExtension(var1); } - @Override - public void addExtensionTypeWriterFactory(ExtensionTypeWriterFactory factory) { - this.writer = factory.getWriterImpl(vector); - this.writer.setPosition(idx()); - } - public void write(ExtensionHolder holder) { this.writer.write(holder); } @@ -79,11 +73,7 @@ public void setPosition(int index) { @Override public void writeNull() { - if (this.writer != null) { - this.writer.writeNull(); - } else { - this.vector.setNull(getPosition()); - this.vector.setValueCount(getPosition() + 1); - } + this.vector.setNull(getPosition()); + this.vector.setValueCount(getPosition() + 1); } } diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java b/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java index 406e080d1d..1ba7b27156 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/reader/ExtensionReader.java @@ -16,7 +16,6 @@ */ package org.apache.arrow.vector.complex.reader; -import org.apache.arrow.vector.complex.impl.ExtensionTypeWriterFactory; import org.apache.arrow.vector.holders.ExtensionHolder; /** Interface for reading extension types. Extends the functionality of {@link BaseReader}. */ @@ -42,15 +41,4 @@ public interface ExtensionReader extends BaseReader { * @return true if the value is set, false otherwise */ boolean isSet(); - - /** - * Gets the extension type writer factory associated with this reader. - * - *

The writer factory is used to create appropriate writers when copying extension type values - * to another vector. This allows the copy operation to preserve the extension type semantics. - * - * @return the extension type writer factory - * @throws IllegalStateException if the reader doesn't support extension types - */ - ExtensionTypeWriterFactory getExtensionTypeWriterFactory(); } diff --git a/vector/src/main/java/org/apache/arrow/vector/extension/OpaqueType.java b/vector/src/main/java/org/apache/arrow/vector/extension/OpaqueType.java index ca56214fda..780a4ee659 100644 --- a/vector/src/main/java/org/apache/arrow/vector/extension/OpaqueType.java +++ b/vector/src/main/java/org/apache/arrow/vector/extension/OpaqueType.java @@ -54,10 +54,12 @@ import org.apache.arrow.vector.TimeStampNanoVector; import org.apache.arrow.vector.TimeStampSecTZVector; import org.apache.arrow.vector.TimeStampSecVector; +import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.VarBinaryVector; import org.apache.arrow.vector.VarCharVector; import org.apache.arrow.vector.ViewVarBinaryVector; import org.apache.arrow.vector.ViewVarCharVector; +import org.apache.arrow.vector.complex.writer.FieldWriter; import org.apache.arrow.vector.types.Types; import org.apache.arrow.vector.types.pojo.ArrowType; import org.apache.arrow.vector.types.pojo.ExtensionTypeRegistry; @@ -177,6 +179,11 @@ public int hashCode() { return Objects.hash(super.hashCode(), storageType, typeName, vendorName); } + @Override + public FieldWriter getNewFieldWriter(ValueVector vector) { + throw new UnsupportedOperationException("WriterImpl not yet implemented."); + } + @Override public String toString() { return "OpaqueType(" diff --git a/vector/src/main/java/org/apache/arrow/vector/holders/ExtensionHolder.java b/vector/src/main/java/org/apache/arrow/vector/holders/ExtensionHolder.java index fc7ed85878..4d3f767aef 100644 --- a/vector/src/main/java/org/apache/arrow/vector/holders/ExtensionHolder.java +++ b/vector/src/main/java/org/apache/arrow/vector/holders/ExtensionHolder.java @@ -16,7 +16,11 @@ */ package org.apache.arrow.vector.holders; +import org.apache.arrow.vector.types.pojo.ArrowType; + /** Base {@link ValueHolder} class for a {@link org.apache.arrow.vector.ExtensionTypeVector}. */ public abstract class ExtensionHolder implements ValueHolder { public int isSet; + + public abstract ArrowType type(); } diff --git a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java index ad1a90642e..0eb8f5c066 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestLargeListVector.java @@ -35,7 +35,6 @@ import org.apache.arrow.vector.complex.ListVector; import org.apache.arrow.vector.complex.impl.UnionLargeListReader; import org.apache.arrow.vector.complex.impl.UnionLargeListWriter; -import org.apache.arrow.vector.complex.impl.UuidWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.complex.writer.BaseWriter.ExtensionWriter; import org.apache.arrow.vector.holder.UuidHolder; @@ -1040,8 +1039,7 @@ public void testCopyValueSafeForExtensionType() throws Exception { UUID u1 = UUID.randomUUID(); UUID u2 = UUID.randomUUID(); writer.startList(); - ExtensionWriter extensionWriter = writer.extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionWriter = writer.extension(UuidType.INSTANCE); extensionWriter.writeExtension(u1); extensionWriter.writeExtension(u2); writer.endList(); @@ -1051,8 +1049,7 @@ public void testCopyValueSafeForExtensionType() throws Exception { UUID u3 = UUID.randomUUID(); UUID u4 = UUID.randomUUID(); writer.startList(); - extensionWriter = writer.extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + extensionWriter = writer.extension(UuidType.INSTANCE); extensionWriter.writeExtension(u3); extensionWriter.writeExtension(u4); extensionWriter.writeNull(); diff --git a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java index fe1829dd09..c206ed2261 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestListVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestListVector.java @@ -36,7 +36,6 @@ import org.apache.arrow.vector.complex.ListVector; import org.apache.arrow.vector.complex.impl.UnionListReader; import org.apache.arrow.vector.complex.impl.UnionListWriter; -import org.apache.arrow.vector.complex.impl.UuidWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.complex.writer.BaseWriter.ExtensionWriter; import org.apache.arrow.vector.holder.UuidHolder; @@ -1216,8 +1215,7 @@ public void testListVectorWithExtensionType() throws Exception { UUID u1 = UUID.randomUUID(); UUID u2 = UUID.randomUUID(); writer.startList(); - ExtensionWriter extensionWriter = writer.extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionWriter = writer.extension(UuidType.INSTANCE); extensionWriter.writeExtension(u1); extensionWriter.writeExtension(u2); writer.endList(); @@ -1244,8 +1242,7 @@ public void testListVectorReaderForExtensionType() throws Exception { UUID u1 = UUID.randomUUID(); UUID u2 = UUID.randomUUID(); writer.startList(); - ExtensionWriter extensionWriter = writer.extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionWriter = writer.extension(UuidType.INSTANCE); extensionWriter.writeExtension(u1); extensionWriter.writeExtension(u2); writer.endList(); @@ -1281,19 +1278,18 @@ public void testCopyFromForExtensionType() throws Exception { UUID u1 = UUID.randomUUID(); UUID u2 = UUID.randomUUID(); writer.startList(); - ExtensionWriter extensionWriter = writer.extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); - extensionWriter.writeExtension(u1); - extensionWriter.writeExtension(u2); - extensionWriter.writeNull(); + + writer.extension(UuidType.INSTANCE).writeExtension(u1); + writer.writeExtension(u2); + writer.writeNull(); writer.endList(); - writer.setValueCount(1); + writer.setValueCount(3); // copy values from input to output outVector.allocateNew(); outVector.copyFrom(0, 0, inVector); - outVector.setValueCount(1); + outVector.setValueCount(3); UnionListReader reader = outVector.getReader(); assertTrue(reader.isSet(), "shouldn't be null"); @@ -1326,8 +1322,7 @@ public void testCopyValueSafeForExtensionType() throws Exception { UUID u1 = UUID.randomUUID(); UUID u2 = UUID.randomUUID(); writer.startList(); - ExtensionWriter extensionWriter = writer.extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionWriter = writer.extension(UuidType.INSTANCE); extensionWriter.writeExtension(u1); extensionWriter.writeExtension(u2); writer.endList(); @@ -1337,8 +1332,7 @@ public void testCopyValueSafeForExtensionType() throws Exception { UUID u3 = UUID.randomUUID(); UUID u4 = UUID.randomUUID(); writer.startList(); - extensionWriter = writer.extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + extensionWriter = writer.extension(UuidType.INSTANCE); extensionWriter.writeExtension(u3); extensionWriter.writeExtension(u4); extensionWriter.writeNull(); diff --git a/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java b/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java index 9bcb00df79..29b6151824 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java @@ -36,7 +36,6 @@ import org.apache.arrow.vector.complex.StructVector; import org.apache.arrow.vector.complex.impl.UnionMapReader; import org.apache.arrow.vector.complex.impl.UnionMapWriter; -import org.apache.arrow.vector.complex.impl.UuidWriterFactory; import org.apache.arrow.vector.complex.reader.FieldReader; import org.apache.arrow.vector.complex.writer.BaseWriter.ExtensionWriter; import org.apache.arrow.vector.complex.writer.BaseWriter.ListWriter; @@ -1284,14 +1283,12 @@ public void testMapVectorWithExtensionType() throws Exception { writer.startMap(); writer.startEntry(); writer.key().bigInt().writeBigInt(0); - ExtensionWriter extensionWriter = writer.value().extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionWriter = writer.value().extension(UuidType.INSTANCE); extensionWriter.writeExtension(u1); writer.endEntry(); writer.startEntry(); writer.key().bigInt().writeBigInt(1); - extensionWriter = writer.value().extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + extensionWriter = writer.value().extension(UuidType.INSTANCE); extensionWriter.writeExtension(u2); writer.endEntry(); writer.endMap(); @@ -1328,14 +1325,12 @@ public void testCopyFromForExtensionType() throws Exception { writer.startMap(); writer.startEntry(); writer.key().bigInt().writeBigInt(0); - ExtensionWriter extensionWriter = writer.value().extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionWriter = writer.value().extension(UuidType.INSTANCE); extensionWriter.writeExtension(u1); writer.endEntry(); writer.startEntry(); writer.key().bigInt().writeBigInt(1); - extensionWriter = writer.value().extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + extensionWriter = writer.value().extension(UuidType.INSTANCE); extensionWriter.writeExtension(u2); writer.endEntry(); writer.endMap(); diff --git a/vector/src/test/java/org/apache/arrow/vector/TestStructVector.java b/vector/src/test/java/org/apache/arrow/vector/TestStructVector.java index d40af9ae89..307c636270 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestStructVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestStructVector.java @@ -160,17 +160,23 @@ public void testGetPrimitiveVectors() { UnionVector unionVector = vector.addOrGetUnion("union"); unionVector.addVector(new BigIntVector("bigInt", allocator)); unionVector.addVector(new SmallIntVector("smallInt", allocator)); + unionVector.addVector(new UuidVector("uuid", allocator)); // add varchar vector vector.addOrGet( "varchar", FieldType.nullable(MinorType.VARCHAR.getType()), VarCharVector.class); + // add extension vector + vector.addOrGet("extension", FieldType.nullable(UuidType.INSTANCE), UuidVector.class); + List primitiveVectors = vector.getPrimitiveVectors(); - assertEquals(4, primitiveVectors.size()); + assertEquals(6, primitiveVectors.size()); assertEquals(MinorType.INT, primitiveVectors.get(0).getMinorType()); assertEquals(MinorType.BIGINT, primitiveVectors.get(1).getMinorType()); assertEquals(MinorType.SMALLINT, primitiveVectors.get(2).getMinorType()); - assertEquals(MinorType.VARCHAR, primitiveVectors.get(3).getMinorType()); + assertEquals(MinorType.EXTENSIONTYPE, primitiveVectors.get(3).getMinorType()); + assertEquals(MinorType.VARCHAR, primitiveVectors.get(4).getMinorType()); + assertEquals(MinorType.EXTENSIONTYPE, primitiveVectors.get(5).getMinorType()); } } diff --git a/vector/src/test/java/org/apache/arrow/vector/UuidVector.java b/vector/src/test/java/org/apache/arrow/vector/UuidVector.java index 72ba4aa555..d64be54c36 100644 --- a/vector/src/test/java/org/apache/arrow/vector/UuidVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/UuidVector.java @@ -22,6 +22,7 @@ import org.apache.arrow.memory.util.hash.ArrowBufHasher; import org.apache.arrow.vector.complex.impl.UuidReaderImpl; import org.apache.arrow.vector.complex.reader.FieldReader; +import org.apache.arrow.vector.holder.NullableUuidHolder; import org.apache.arrow.vector.holder.UuidHolder; import org.apache.arrow.vector.types.pojo.Field; import org.apache.arrow.vector.types.pojo.FieldType; @@ -97,6 +98,11 @@ public void get(int index, UuidHolder holder) { holder.isSet = 1; } + public void get(int index, NullableUuidHolder holder) { + holder.value = getUnderlyingVector().get(index); + holder.isSet = 1; + } + public class TransferImpl implements TransferPair { UuidVector to; ValueVector targetUnderlyingVector; diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java b/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java index 51a3ff5965..cecb42b92c 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java +++ b/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java @@ -860,8 +860,7 @@ public void testCopyListVectorWithExtensionType() { for (int i = 0; i < COUNT; i++) { listWriter.setPosition(i); listWriter.startList(); - ExtensionWriter extensionWriter = listWriter.extension(new UuidType()); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionWriter = listWriter.extension(UuidType.INSTANCE); extensionWriter.writeExtension(UUID.randomUUID()); extensionWriter.writeExtension(UUID.randomUUID()); listWriter.endList(); @@ -896,11 +895,9 @@ public void testCopyMapVectorWithExtensionType() { mapWriter.setPosition(i); mapWriter.startMap(); mapWriter.startEntry(); - ExtensionWriter extensionKeyWriter = mapWriter.key().extension(new UuidType()); - extensionKeyWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionKeyWriter = mapWriter.key().extension(UuidType.INSTANCE); extensionKeyWriter.writeExtension(UUID.randomUUID()); - ExtensionWriter extensionValueWriter = mapWriter.value().extension(new UuidType()); - extensionValueWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionValueWriter = mapWriter.value().extension(UuidType.INSTANCE); extensionValueWriter.writeExtension(UUID.randomUUID()); mapWriter.endEntry(); mapWriter.endMap(); @@ -934,11 +931,9 @@ public void testCopyStructVectorWithExtensionType() { for (int i = 0; i < COUNT; i++) { structWriter.setPosition(i); structWriter.start(); - ExtensionWriter extensionWriter1 = structWriter.extension("timestamp1", new UuidType()); - extensionWriter1.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionWriter1 = structWriter.extension("uuid1", UuidType.INSTANCE); extensionWriter1.writeExtension(UUID.randomUUID()); - ExtensionWriter extensionWriter2 = structWriter.extension("timestamp2", new UuidType()); - extensionWriter2.addExtensionTypeWriterFactory(new UuidWriterFactory()); + ExtensionWriter extensionWriter2 = structWriter.extension("uuid2", UuidType.INSTANCE); extensionWriter2.writeExtension(UUID.randomUUID()); structWriter.end(); } diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java b/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java index 7b8b1f9ef9..3a5f6b2954 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java +++ b/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java @@ -31,6 +31,7 @@ import org.apache.arrow.memory.BufferAllocator; import org.apache.arrow.vector.DecimalVector; import org.apache.arrow.vector.DirtyRootAllocator; +import org.apache.arrow.vector.FieldVector; import org.apache.arrow.vector.LargeVarBinaryVector; import org.apache.arrow.vector.LargeVarCharVector; import org.apache.arrow.vector.UuidVector; @@ -41,6 +42,7 @@ import org.apache.arrow.vector.complex.StructVector; import org.apache.arrow.vector.complex.UnionVector; import org.apache.arrow.vector.complex.writer.BaseWriter.StructWriter; +import org.apache.arrow.vector.holder.UuidHolder; import org.apache.arrow.vector.holders.DurationHolder; import org.apache.arrow.vector.holders.FixedSizeBinaryHolder; import org.apache.arrow.vector.holders.NullableDecimalHolder; @@ -100,7 +102,6 @@ public void testPromoteToUnion() throws Exception { writer.integer("A").writeInt(10); // we don't write anything in 3 - writer.setPosition(4); writer.integer("A").writeInt(100); @@ -130,9 +131,23 @@ public void testPromoteToUnion() throws Exception { binHolder.buffer = buf; writer.fixedSizeBinary("A", 4).write(binHolder); + writer.setPosition(9); + UUID uuid = UUID.randomUUID(); + writer.extension("A", UuidType.INSTANCE).writeExtension(uuid); + writer.end(); + + writer.setPosition(10); + UUID uuid2 = UUID.randomUUID(); + UuidHolder uuidHolder = new UuidHolder(); + uuidHolder.value = + ByteBuffer.allocate(16) + .putLong(uuid2.getMostSignificantBits()) + .putLong(uuid2.getLeastSignificantBits()) + .array(); + writer.extension("A", UuidType.INSTANCE).write(uuidHolder); writer.end(); - container.setValueCount(9); + container.setValueCount(11); final UnionVector uv = v.getChild("A", UnionVector.class); @@ -169,6 +184,12 @@ public void testPromoteToUnion() throws Exception { .order(ByteOrder.nativeOrder()) .getInt()); + assertFalse(uv.isNull(9), "9 shouldn't be null"); + assertEquals(uuid, uv.getObject(9)); + + assertFalse(uv.isNull(10), "10 shouldn't be null"); + assertEquals(uuid2, uv.getObject(10)); + container.clear(); container.allocateNew(); @@ -785,13 +806,12 @@ public void testExtensionType() throws Exception { try (final NonNullableStructVector container = NonNullableStructVector.empty(EMPTY_SCHEMA_PATH, allocator); final UuidVector v = - container.addOrGet("uuid", FieldType.nullable(new UuidType()), UuidVector.class); + container.addOrGet("uuid", FieldType.nullable(UuidType.INSTANCE), UuidVector.class); final PromotableWriter writer = new PromotableWriter(v, container)) { UUID u1 = UUID.randomUUID(); UUID u2 = UUID.randomUUID(); container.allocateNew(); container.setValueCount(1); - writer.addExtensionTypeWriterFactory(new UuidWriterFactory()); writer.setPosition(0); writer.writeExtension(u1); @@ -810,13 +830,13 @@ public void testExtensionType() throws Exception { public void testExtensionTypeForList() throws Exception { try (final ListVector container = ListVector.empty(EMPTY_SCHEMA_PATH, allocator); final UuidVector v = - (UuidVector) container.addOrGetVector(FieldType.nullable(new UuidType())).getVector(); + (UuidVector) + container.addOrGetVector(FieldType.nullable(UuidType.INSTANCE)).getVector(); final PromotableWriter writer = new PromotableWriter(v, container)) { UUID u1 = UUID.randomUUID(); UUID u2 = UUID.randomUUID(); container.allocateNew(); container.setValueCount(1); - writer.addExtensionTypeWriterFactory(new UuidWriterFactory()); writer.setPosition(0); writer.writeExtension(u1); @@ -825,7 +845,7 @@ public void testExtensionTypeForList() throws Exception { container.setValueCount(2); - UuidVector uuidVector = (UuidVector) container.getDataVector(); + FieldVector uuidVector = container.getDataVector(); assertEquals(u1, uuidVector.getObject(0)); assertEquals(u2, uuidVector.getObject(1)); } diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidReaderImpl.java b/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidReaderImpl.java index 06a389ced0..1f0af6d666 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidReaderImpl.java +++ b/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidReaderImpl.java @@ -17,6 +17,7 @@ package org.apache.arrow.vector.complex.impl; import org.apache.arrow.vector.UuidVector; +import org.apache.arrow.vector.holder.NullableUuidHolder; import org.apache.arrow.vector.holder.UuidHolder; import org.apache.arrow.vector.holders.ExtensionHolder; import org.apache.arrow.vector.types.Types.MinorType; @@ -46,9 +47,18 @@ public boolean isSet() { return !vector.isNull(idx()); } - @Override public void read(ExtensionHolder holder) { - vector.get(idx(), (UuidHolder) holder); + if (holder instanceof NullableUuidHolder) { + vector.get(idx(), (NullableUuidHolder) holder); + } else if (holder instanceof UuidHolder) { + vector.get(idx(), (UuidHolder) holder); + } else { + throw new IllegalArgumentException("Holder type not supported"); + } + } + + public void read(NullableUuidHolder holder) { + vector.get(idx(), holder); } @Override @@ -66,9 +76,4 @@ public void copyAsValue(AbstractExtensionTypeWriter writer) { public Object readObject() { return vector.getObject(idx()); } - - @Override - public ExtensionTypeWriterFactory getExtensionTypeWriterFactory() { - return new UuidWriterFactory(); - } } diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java b/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java index f374eb41e4..b9f1500079 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java +++ b/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java @@ -66,7 +66,6 @@ import org.apache.arrow.vector.complex.impl.UnionMapReader; import org.apache.arrow.vector.complex.impl.UnionReader; import org.apache.arrow.vector.complex.impl.UnionWriter; -import org.apache.arrow.vector.complex.impl.UuidWriterFactory; import org.apache.arrow.vector.complex.reader.BaseReader.StructReader; import org.apache.arrow.vector.complex.reader.BigIntReader; import org.apache.arrow.vector.complex.reader.FieldReader; @@ -78,6 +77,7 @@ import org.apache.arrow.vector.complex.writer.BaseWriter.ListWriter; import org.apache.arrow.vector.complex.writer.BaseWriter.MapWriter; import org.apache.arrow.vector.complex.writer.BaseWriter.StructWriter; +import org.apache.arrow.vector.holder.NullableUuidHolder; import org.apache.arrow.vector.holder.UuidHolder; import org.apache.arrow.vector.holders.DecimalHolder; import org.apache.arrow.vector.holders.DurationHolder; @@ -1105,6 +1105,13 @@ public void simpleUnion() throws Exception { new UnionVector("union", allocator, /* field type */ null, /* call-back */ null); UnionWriter unionWriter = new UnionWriter(vector); unionWriter.allocate(); + + UUID uuid = UUID.randomUUID(); + ByteBuffer bb = ByteBuffer.allocate(16); + bb.putLong(uuid.getMostSignificantBits()); + bb.putLong(uuid.getLeastSignificantBits()); + byte[] uuidByte = bb.array(); + for (int i = 0; i < COUNT; i++) { unionWriter.setPosition(i); if (i % 5 == 0) { @@ -1127,6 +1134,11 @@ public void simpleUnion() throws Exception { holder.buffer = buf; unionWriter.write(holder); bufs.add(buf); + } else if (i % 5 == 4) { + UuidHolder holder = new UuidHolder(); + + holder.value = uuidByte; + unionWriter.write(holder); } else { unionWriter.writeFloat4((float) i); } @@ -1152,6 +1164,13 @@ public void simpleUnion() throws Exception { unionReader.read(holder); assertEquals(i, holder.buffer.getInt(0)); assertEquals(4, holder.byteWidth); + } else if (i % 5 == 4) { + NullableUuidHolder holder = new NullableUuidHolder(); + unionReader.read(holder); + ByteBuffer b = ByteBuffer.wrap(holder.value); + long high = b.getLong(); + long low = b.getLong(); + assertEquals(new UUID(high, low), uuid); } else { assertEquals((float) i, unionReader.readFloat(), 1e-12); } @@ -2509,9 +2528,8 @@ public void extensionWriterReader() throws Exception { StructWriter rootWriter = writer.rootAsStruct(); { - ExtensionWriter extensionWriter = rootWriter.extension("uuid1", new UuidType()); + ExtensionWriter extensionWriter = rootWriter.extension("uuid1", UuidType.INSTANCE); extensionWriter.setPosition(0); - extensionWriter.addExtensionTypeWriterFactory(new UuidWriterFactory()); extensionWriter.writeExtension(u1); } // read diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidWriterFactory.java b/vector/src/test/java/org/apache/arrow/vector/holder/NullableUuidHolder.java similarity index 65% rename from vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidWriterFactory.java rename to vector/src/test/java/org/apache/arrow/vector/holder/NullableUuidHolder.java index 1b1bf4e6e4..5b5061e42d 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidWriterFactory.java +++ b/vector/src/test/java/org/apache/arrow/vector/holder/NullableUuidHolder.java @@ -14,18 +14,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.arrow.vector.complex.impl; +package org.apache.arrow.vector.holder; -import org.apache.arrow.vector.ExtensionTypeVector; -import org.apache.arrow.vector.UuidVector; +import org.apache.arrow.vector.holders.ExtensionHolder; +import org.apache.arrow.vector.types.pojo.ArrowType; +import org.apache.arrow.vector.types.pojo.UuidType; -public class UuidWriterFactory implements ExtensionTypeWriterFactory { +public class NullableUuidHolder extends ExtensionHolder { + public byte[] value; @Override - public AbstractFieldWriter getWriterImpl(ExtensionTypeVector extensionTypeVector) { - if (extensionTypeVector instanceof UuidVector) { - return new UuidWriterImpl((UuidVector) extensionTypeVector); - } - return null; + public ArrowType type() { + return UuidType.INSTANCE; } } diff --git a/vector/src/test/java/org/apache/arrow/vector/holder/UuidHolder.java b/vector/src/test/java/org/apache/arrow/vector/holder/UuidHolder.java index 207b0951a7..301d8eddd1 100644 --- a/vector/src/test/java/org/apache/arrow/vector/holder/UuidHolder.java +++ b/vector/src/test/java/org/apache/arrow/vector/holder/UuidHolder.java @@ -17,7 +17,14 @@ package org.apache.arrow.vector.holder; import org.apache.arrow.vector.holders.ExtensionHolder; +import org.apache.arrow.vector.types.pojo.ArrowType; +import org.apache.arrow.vector.types.pojo.UuidType; public class UuidHolder extends ExtensionHolder { public byte[] value; + + @Override + public ArrowType type() { + return UuidType.INSTANCE; + } } diff --git a/vector/src/test/java/org/apache/arrow/vector/types/pojo/TestExtensionType.java b/vector/src/test/java/org/apache/arrow/vector/types/pojo/TestExtensionType.java index d24708d66c..3d6f9ff73d 100644 --- a/vector/src/test/java/org/apache/arrow/vector/types/pojo/TestExtensionType.java +++ b/vector/src/test/java/org/apache/arrow/vector/types/pojo/TestExtensionType.java @@ -43,10 +43,12 @@ import org.apache.arrow.vector.Float4Vector; import org.apache.arrow.vector.UuidVector; import org.apache.arrow.vector.ValueIterableVector; +import org.apache.arrow.vector.ValueVector; import org.apache.arrow.vector.VectorSchemaRoot; import org.apache.arrow.vector.compare.Range; import org.apache.arrow.vector.compare.RangeEqualsVisitor; import org.apache.arrow.vector.complex.StructVector; +import org.apache.arrow.vector.complex.writer.FieldWriter; import org.apache.arrow.vector.ipc.ArrowFileReader; import org.apache.arrow.vector.ipc.ArrowFileWriter; import org.apache.arrow.vector.types.FloatingPointPrecision; @@ -331,6 +333,11 @@ public String serialize() { public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator) { return new LocationVector(name, allocator); } + + @Override + public FieldWriter getNewFieldWriter(ValueVector vector) { + throw new UnsupportedOperationException("Not yet implemented."); + } } public static class LocationVector extends ExtensionTypeVector diff --git a/vector/src/test/java/org/apache/arrow/vector/types/pojo/UuidType.java b/vector/src/test/java/org/apache/arrow/vector/types/pojo/UuidType.java index 5e2bd8881b..dbd88927ce 100644 --- a/vector/src/test/java/org/apache/arrow/vector/types/pojo/UuidType.java +++ b/vector/src/test/java/org/apache/arrow/vector/types/pojo/UuidType.java @@ -20,9 +20,13 @@ import org.apache.arrow.vector.FieldVector; import org.apache.arrow.vector.FixedSizeBinaryVector; import org.apache.arrow.vector.UuidVector; +import org.apache.arrow.vector.ValueVector; +import org.apache.arrow.vector.complex.impl.UuidWriterImpl; +import org.apache.arrow.vector.complex.writer.FieldWriter; import org.apache.arrow.vector.types.pojo.ArrowType.ExtensionType; public class UuidType extends ExtensionType { + public static final UuidType INSTANCE = new UuidType(); @Override public ArrowType storageType() { @@ -57,4 +61,9 @@ public String serialize() { public FieldVector getNewVector(String name, FieldType fieldType, BufferAllocator allocator) { return new UuidVector(name, allocator, new FixedSizeBinaryVector(name, allocator, 16)); } + + @Override + public FieldWriter getNewFieldWriter(ValueVector vector) { + return new UuidWriterImpl((UuidVector) vector); + } } From d51f2bb36a9db5f72b553feab6495d9ed75c67ef Mon Sep 17 00:00:00 2001 From: jhrotko Date: Mon, 10 Nov 2025 17:26:18 +0000 Subject: [PATCH 10/12] Add base implementation for method getNewFieldWriter --- vector/src/main/codegen/templates/ArrowType.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vector/src/main/codegen/templates/ArrowType.java b/vector/src/main/codegen/templates/ArrowType.java index 5daf57c3d3..b428f09155 100644 --- a/vector/src/main/codegen/templates/ArrowType.java +++ b/vector/src/main/codegen/templates/ArrowType.java @@ -334,7 +334,9 @@ public T accept(ArrowTypeVisitor visitor) { return visitor.visit(this); } - public abstract FieldWriter getNewFieldWriter(ValueVector vector); + public FieldWriter getNewFieldWriter(ValueVector vector) { + throw new UnsupportedOperationException("WriterImpl not yet implemented."); + } } private static final int defaultDecimalBitWidth = 128; From a7b0daeb8358a6ff68634bd655eb0bb016ff62bd Mon Sep 17 00:00:00 2001 From: jhrotko Date: Tue, 11 Nov 2025 20:14:43 +0000 Subject: [PATCH 11/12] use holder type --- vector/src/main/codegen/templates/PromotableWriter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vector/src/main/codegen/templates/PromotableWriter.java b/vector/src/main/codegen/templates/PromotableWriter.java index 83e6b39c55..7dc8d950b4 100644 --- a/vector/src/main/codegen/templates/PromotableWriter.java +++ b/vector/src/main/codegen/templates/PromotableWriter.java @@ -561,7 +561,7 @@ public void writeExtension(Object value, ArrowType arrowType) { @Override public void write(ExtensionHolder holder) { - getWriter(MinorType.EXTENSIONTYPE, lastExtensionType).write(holder); + getWriter(MinorType.EXTENSIONTYPE, holder.type()).write(holder); } @Override From 1a9f2050c14b32acb0085fe7de1534d93fea87c2 Mon Sep 17 00:00:00 2001 From: jhrotko Date: Tue, 18 Nov 2025 18:46:56 +0000 Subject: [PATCH 12/12] wip: remove lastExtentionType --- .../templates/AbstractFieldWriter.java | 8 +- .../main/codegen/templates/BaseWriter.java | 8 ++ .../main/codegen/templates/ComplexCopier.java | 2 +- .../codegen/templates/PromotableWriter.java | 16 +-- .../codegen/templates/UnionListWriter.java | 5 + .../complex/impl/UnionExtensionWriter.java | 1 + .../apache/arrow/vector/TestMapVector.java | 110 +++++++++++++++++- .../complex/impl/TestComplexCopier.java | 8 +- .../complex/impl/TestPromotableWriter.java | 10 +- .../vector/complex/impl/UuidWriterImpl.java | 6 + .../complex/writer/TestComplexWriter.java | 2 +- 11 files changed, 143 insertions(+), 33 deletions(-) diff --git a/vector/src/main/codegen/templates/AbstractFieldWriter.java b/vector/src/main/codegen/templates/AbstractFieldWriter.java index bcdc5c5302..4b4a17d932 100644 --- a/vector/src/main/codegen/templates/AbstractFieldWriter.java +++ b/vector/src/main/codegen/templates/AbstractFieldWriter.java @@ -109,11 +109,15 @@ public void endEntry() { @Override public void write(ExtensionHolder var1) { - this.fail("ExtensionType"); + this.fail("Cannot write ExtensionHolder"); } @Override public void writeExtension(Object var1) { - this.fail("ExtensionType"); + this.fail("Cannot write extension object"); + } + @Override + public void writeExtension(Object var1, ArrowType type) { + this.fail("Cannot write extension with type " + type); } <#list vv.types as type><#list type.minor as minor><#assign name = minor.class?cap_first /> diff --git a/vector/src/main/codegen/templates/BaseWriter.java b/vector/src/main/codegen/templates/BaseWriter.java index e5333ef292..a4c98d7089 100644 --- a/vector/src/main/codegen/templates/BaseWriter.java +++ b/vector/src/main/codegen/templates/BaseWriter.java @@ -123,6 +123,14 @@ public interface ExtensionWriter extends BaseWriter { * @param value the extension type value to write */ void writeExtension(Object value); + + /** + * Writes the given extension type value. + * + * @param value the extension type value to write + * @param type of the extension + */ + void writeExtension(Object value, ArrowType type); } public interface ScalarWriter extends diff --git a/vector/src/main/codegen/templates/ComplexCopier.java b/vector/src/main/codegen/templates/ComplexCopier.java index b6449e0e94..6655f6c2a7 100644 --- a/vector/src/main/codegen/templates/ComplexCopier.java +++ b/vector/src/main/codegen/templates/ComplexCopier.java @@ -111,7 +111,7 @@ public static void copy(FieldReader reader, FieldWriter writer) { if (reader.isSet()) { Object value = reader.readObject(); if (value != null) { - writer.writeExtension(value); + writer.writeExtension(value, reader.getField().getType()); } } else { writer.writeNull(); diff --git a/vector/src/main/codegen/templates/PromotableWriter.java b/vector/src/main/codegen/templates/PromotableWriter.java index 7dc8d950b4..11d34f72c9 100644 --- a/vector/src/main/codegen/templates/PromotableWriter.java +++ b/vector/src/main/codegen/templates/PromotableWriter.java @@ -325,9 +325,6 @@ protected boolean requiresArrowType(MinorType type) { @Override protected FieldWriter getWriter(MinorType type, ArrowType arrowType) { - if(type == MinorType.EXTENSIONTYPE) { - lastExtensionType = arrowType; - } if (state == State.UNION) { if (requiresArrowType(type)) { ((UnionWriter) writer).getWriter(type, arrowType); @@ -543,20 +540,9 @@ public void writeLargeVarChar(String value) { getWriter(MinorType.LARGEVARCHAR).writeLargeVarChar(value); } - protected ArrowType lastExtensionType; - @Override - public void writeExtension(Object value) { - FieldWriter writer = getWriter(MinorType.EXTENSIONTYPE, lastExtensionType); - if(writer instanceof UnionWriter) { - ((UnionWriter) writer).writeExtension(value, lastExtensionType); - } else { - writer.writeExtension(value); - } - } - public void writeExtension(Object value, ArrowType arrowType) { - getWriter(MinorType.EXTENSIONTYPE, arrowType).writeExtension(value); + getWriter(MinorType.EXTENSIONTYPE, arrowType).writeExtension(value, arrowType); } @Override diff --git a/vector/src/main/codegen/templates/UnionListWriter.java b/vector/src/main/codegen/templates/UnionListWriter.java index a01d6ece30..4b54739230 100644 --- a/vector/src/main/codegen/templates/UnionListWriter.java +++ b/vector/src/main/codegen/templates/UnionListWriter.java @@ -341,6 +341,11 @@ public void writeExtension(Object value) { writer.setPosition(writer.idx() + 1); } + @Override + public void writeExtension(Object value, ArrowType type) { + writeExtension(value); + } + public void write(ExtensionHolder var1) { writer.write(var1); writer.setPosition(writer.idx() + 1); diff --git a/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java b/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java index 52e63306d8..93796aa77e 100644 --- a/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java +++ b/vector/src/main/java/org/apache/arrow/vector/complex/impl/UnionExtensionWriter.java @@ -59,6 +59,7 @@ public void writeExtension(Object var1) { this.writer.writeExtension(var1); } + @Override public void write(ExtensionHolder holder) { this.writer.write(holder); } diff --git a/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java b/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java index 29b6151824..497c257d8a 100644 --- a/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java +++ b/vector/src/test/java/org/apache/arrow/vector/TestMapVector.java @@ -1284,12 +1284,12 @@ public void testMapVectorWithExtensionType() throws Exception { writer.startEntry(); writer.key().bigInt().writeBigInt(0); ExtensionWriter extensionWriter = writer.value().extension(UuidType.INSTANCE); - extensionWriter.writeExtension(u1); + extensionWriter.writeExtension(u1, UuidType.INSTANCE); writer.endEntry(); writer.startEntry(); writer.key().bigInt().writeBigInt(1); extensionWriter = writer.value().extension(UuidType.INSTANCE); - extensionWriter.writeExtension(u2); + extensionWriter.writeExtension(u2, UuidType.INSTANCE); writer.endEntry(); writer.endMap(); @@ -1326,12 +1326,11 @@ public void testCopyFromForExtensionType() throws Exception { writer.startEntry(); writer.key().bigInt().writeBigInt(0); ExtensionWriter extensionWriter = writer.value().extension(UuidType.INSTANCE); - extensionWriter.writeExtension(u1); + extensionWriter.writeExtension(u1, UuidType.INSTANCE); writer.endEntry(); writer.startEntry(); writer.key().bigInt().writeBigInt(1); - extensionWriter = writer.value().extension(UuidType.INSTANCE); - extensionWriter.writeExtension(u2); + extensionWriter.writeExtension(u2, UuidType.INSTANCE); writer.endEntry(); writer.endMap(); @@ -1575,4 +1574,105 @@ public void testFixedSizeBinaryFirstInitialization() { assertArrayEquals(new byte[] {32, 21}, (byte[]) resultStruct.get(MapVector.VALUE_NAME)); } } + + @Test + public void testMapWithUuidKeyAndListUuidValue() throws Exception { + try (final MapVector mapVector = MapVector.empty("map", allocator, false)) { + mapVector.allocateNew(); + UnionMapWriter writer = mapVector.getWriter(); + + // Create test UUIDs + UUID key1 = UUID.randomUUID(); + UUID key2 = UUID.randomUUID(); + UUID value1a = UUID.randomUUID(); + UUID value1b = UUID.randomUUID(); + UUID value2a = UUID.randomUUID(); + UUID value2b = UUID.randomUUID(); + UUID value2c = UUID.randomUUID(); + + // Write first map entry: {key1 -> [value1a, value1b]} + writer.setPosition(0); + writer.startMap(); + + writer.startEntry(); + ExtensionWriter keyWriter = writer.key().extension(UuidType.INSTANCE); + keyWriter.writeExtension(key1, UuidType.INSTANCE); + ListWriter valueWriter = writer.value().list(); + valueWriter.startList(); + ExtensionWriter listItemWriter = valueWriter.extension(UuidType.INSTANCE); + listItemWriter.writeExtension(value1a, UuidType.INSTANCE); + listItemWriter = valueWriter.extension(UuidType.INSTANCE); + listItemWriter.writeExtension(value1b, UuidType.INSTANCE); + valueWriter.endList(); + writer.endEntry(); + + writer.startEntry(); + keyWriter = writer.key().extension(UuidType.INSTANCE); + keyWriter.writeExtension(key2, UuidType.INSTANCE); + valueWriter = writer.value().list(); + valueWriter.startList(); + listItemWriter = valueWriter.extension(UuidType.INSTANCE); + listItemWriter.writeExtension(value2a, UuidType.INSTANCE); + listItemWriter = valueWriter.extension(UuidType.INSTANCE); + listItemWriter.writeExtension(value2b, UuidType.INSTANCE); + listItemWriter = valueWriter.extension(UuidType.INSTANCE); + listItemWriter.writeExtension(value2c, UuidType.INSTANCE); + valueWriter.endList(); + writer.endEntry(); + + writer.endMap(); + writer.setValueCount(1); + + // Read and verify the data + UnionMapReader mapReader = mapVector.getReader(); + mapReader.setPosition(0); + + // Read first entry + mapReader.next(); + FieldReader keyReader = mapReader.key(); + UuidHolder keyHolder = new UuidHolder(); + keyReader.read(keyHolder); + ByteBuffer bb = ByteBuffer.wrap(keyHolder.value); + UUID actualKey = new UUID(bb.getLong(), bb.getLong()); + assertEquals(key1, actualKey); + + FieldReader valueReader = mapReader.value(); + assertTrue(valueReader.isSet()); + List listValue = (List) valueReader.readObject(); + assertEquals(2, listValue.size()); + + // Verify first list item - readObject() returns UUID objects for extension types + UUID actualValue1a = (UUID) listValue.get(0); + assertEquals(value1a, actualValue1a); + + // Verify second list item + UUID actualValue1b = (UUID) listValue.get(1); + assertEquals(value1b, actualValue1b); + + // Read second entry + mapReader.next(); + keyReader = mapReader.key(); + keyReader.read(keyHolder); + bb = ByteBuffer.wrap(keyHolder.value); + actualKey = new UUID(bb.getLong(), bb.getLong()); + assertEquals(key2, actualKey); + + valueReader = mapReader.value(); + assertTrue(valueReader.isSet()); + listValue = (List) valueReader.readObject(); + assertEquals(3, listValue.size()); + + // Verify first list item - readObject() returns UUID objects for extension types + UUID actualValue2a = (UUID) listValue.get(0); + assertEquals(value2a, actualValue2a); + + // Verify second list item + UUID actualValue2b = (UUID) listValue.get(1); + assertEquals(value2b, actualValue2b); + + // Verify third list item + UUID actualValue2c = (UUID) listValue.get(2); + assertEquals(value2c, actualValue2c); + } + } } diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java b/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java index cecb42b92c..872b7a16f1 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java +++ b/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestComplexCopier.java @@ -896,9 +896,9 @@ public void testCopyMapVectorWithExtensionType() { mapWriter.startMap(); mapWriter.startEntry(); ExtensionWriter extensionKeyWriter = mapWriter.key().extension(UuidType.INSTANCE); - extensionKeyWriter.writeExtension(UUID.randomUUID()); + extensionKeyWriter.writeExtension(UUID.randomUUID(), UuidType.INSTANCE); ExtensionWriter extensionValueWriter = mapWriter.value().extension(UuidType.INSTANCE); - extensionValueWriter.writeExtension(UUID.randomUUID()); + extensionValueWriter.writeExtension(UUID.randomUUID(), UuidType.INSTANCE); mapWriter.endEntry(); mapWriter.endMap(); } @@ -932,9 +932,9 @@ public void testCopyStructVectorWithExtensionType() { structWriter.setPosition(i); structWriter.start(); ExtensionWriter extensionWriter1 = structWriter.extension("uuid1", UuidType.INSTANCE); - extensionWriter1.writeExtension(UUID.randomUUID()); + extensionWriter1.writeExtension(UUID.randomUUID(), UuidType.INSTANCE); ExtensionWriter extensionWriter2 = structWriter.extension("uuid2", UuidType.INSTANCE); - extensionWriter2.writeExtension(UUID.randomUUID()); + extensionWriter2.writeExtension(UUID.randomUUID(), UuidType.INSTANCE); structWriter.end(); } diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java b/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java index 3a5f6b2954..6efaa333e1 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java +++ b/vector/src/test/java/org/apache/arrow/vector/complex/impl/TestPromotableWriter.java @@ -133,7 +133,7 @@ public void testPromoteToUnion() throws Exception { writer.setPosition(9); UUID uuid = UUID.randomUUID(); - writer.extension("A", UuidType.INSTANCE).writeExtension(uuid); + writer.extension("A", UuidType.INSTANCE).writeExtension(uuid, UuidType.INSTANCE); writer.end(); writer.setPosition(10); @@ -814,9 +814,9 @@ public void testExtensionType() throws Exception { container.setValueCount(1); writer.setPosition(0); - writer.writeExtension(u1); + writer.writeExtension(u1, UuidType.INSTANCE); writer.setPosition(1); - writer.writeExtension(u2); + writer.writeExtension(u2, UuidType.INSTANCE); container.setValueCount(2); @@ -839,9 +839,9 @@ public void testExtensionTypeForList() throws Exception { container.setValueCount(1); writer.setPosition(0); - writer.writeExtension(u1); + writer.writeExtension(u1, UuidType.INSTANCE); writer.setPosition(1); - writer.writeExtension(u2); + writer.writeExtension(u2, UuidType.INSTANCE); container.setValueCount(2); diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidWriterImpl.java b/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidWriterImpl.java index 68029b1df5..d0fb008a47 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidWriterImpl.java +++ b/vector/src/test/java/org/apache/arrow/vector/complex/impl/UuidWriterImpl.java @@ -21,6 +21,7 @@ import org.apache.arrow.vector.UuidVector; import org.apache.arrow.vector.holder.UuidHolder; import org.apache.arrow.vector.holders.ExtensionHolder; +import org.apache.arrow.vector.types.pojo.ArrowType; public class UuidWriterImpl extends AbstractExtensionTypeWriter { @@ -38,6 +39,11 @@ public void writeExtension(Object value) { vector.setValueCount(getPosition() + 1); } + @Override + public void writeExtension(Object value, ArrowType type) { + writeExtension(value); + } + @Override public void write(ExtensionHolder holder) { UuidHolder uuidHolder = (UuidHolder) holder; diff --git a/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java b/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java index b9f1500079..46fc7713fd 100644 --- a/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java +++ b/vector/src/test/java/org/apache/arrow/vector/complex/writer/TestComplexWriter.java @@ -2530,7 +2530,7 @@ public void extensionWriterReader() throws Exception { { ExtensionWriter extensionWriter = rootWriter.extension("uuid1", UuidType.INSTANCE); extensionWriter.setPosition(0); - extensionWriter.writeExtension(u1); + extensionWriter.writeExtension(u1, UuidType.INSTANCE); } // read StructReader rootReader = new SingleStructReaderImpl(parent).reader("root");