Skip to content

Commit

Permalink
fix for SchemaChangeRuntimeException in FixedSizeListVector.TransferI…
Browse files Browse the repository at this point in the history
…mpl.<init>, resolves apache#43320
  • Loading branch information
jarohen committed Jul 18, 2024
1 parent 0bae073 commit f466d25
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,9 @@ public TransferImpl(Field field, BufferAllocator allocator, CallBack callBack) {

public TransferImpl(FixedSizeListVector to) {
this.to = to;
to.addOrGetVector(vector.getField().getFieldType());
if (!(vector instanceof ZeroVector)) {
to.addOrGetVector(vector.getField().getFieldType());
}
dataPair = vector.makeTransferPair(to.vector);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.math.BigDecimal;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.apache.arrow.memory.BufferAllocator;
Expand Down Expand Up @@ -243,6 +244,29 @@ public void testTransferPair() {
}
}

@Test
public void testTransferEmptyVector() throws Exception {
// #43320
try (FixedSizeListVector src = new FixedSizeListVector("src", allocator, FieldType.nullable(new ArrowType.FixedSizeList(2)), null);
FixedSizeListVector dest = new FixedSizeListVector("dest", allocator, FieldType.nullable(new ArrowType.FixedSizeList(2)), null)) {
src.makeTransferPair(dest).transfer();

IntVector els = (IntVector) dest.addOrGetVector(FieldType.nullable(MinorType.INT.getType())).getVector();

dest.allocateNew();
dest.startNewValue(0);
els.setSafe(0, 1);
els.setSafe(1, 2);
dest.setValueCount(1);

List<Integer> expected = new ArrayList<>(2);
expected.add(1);
expected.add(2);

assertEquals(expected, dest.getObject(0));
}
}

@Test
public void testConsistentChildName() throws Exception {
try (FixedSizeListVector listVector =
Expand Down

0 comments on commit f466d25

Please sign in to comment.