Skip to content

Commit 95dc90d

Browse files
Fixes
1 parent 6c43717 commit 95dc90d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

adapter/avro/src/main/java/org/apache/arrow/adapter/avro/ArrowToAvroUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ private static BaseAvroProducer<?> createProducer(FieldVector vector, boolean nu
180180
Producer<?>[] unionChildProducers = new Producer<?>[unionChildVectors.size()];
181181
for (int i = 0; i < unionChildVectors.size(); i++) {
182182
FieldVector unionChildVector = unionChildVectors.get(i);
183-
unionChildProducers[i] = createProducer(unionChildVector, /* nullable = */ false); // Do not nest union types
183+
unionChildProducers[i] = createProducer(unionChildVector, /* nullable = */ false); // Do not nest union types
184184
}
185185
return new AvroUnionsProducer(unionVector, unionChildProducers);
186186

adapter/avro/src/main/java/org/apache/arrow/adapter/avro/producers/AvroStringProducer.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,15 @@ public AvroStringProducer(VarCharVector vector) {
3737

3838
@Override
3939
public void produce(Encoder encoder) throws IOException {
40+
41+
int start = vector.getStartOffset(currentIndex);
42+
int end = vector.getEndOffset(currentIndex);
43+
int length = end - start;
44+
4045
// The nio ByteBuffer is created once per call, but underlying data is not copied
41-
long offset = vector.getStartOffset(currentIndex);
42-
int length = vector.getEndOffset(currentIndex);
43-
ByteBuffer nioBuffer = vector.getDataBuffer().nioBuffer(offset, length);
46+
ByteBuffer nioBuffer = vector.getDataBuffer().nioBuffer(start, length);
4447
encoder.writeBytes(nioBuffer);
48+
4549
currentIndex++;
4650
}
4751
}

0 commit comments

Comments
 (0)