Skip to content

Commit 17be62a

Browse files
committed
Add a hack
1 parent 8bb4286 commit 17be62a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

common/src/main/java/org/apache/arrow/c/CometBufferImportTypeVisitor.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,12 @@ public List<ArrowBuf> visit(ArrowType.Utf8 type) {
237237
type,
238238
start,
239239
end);
240-
final int len = end - start;
240+
// HACK: For the issue https://github.com/apache/datafusion-comet/issues/540
241+
// As Arrow Java doesn't support `offset` in C Data interface, we cannot correctly import
242+
// a slice of string from arrow-rs to Java Arrow and then export it to arrow-rs again.
243+
// So we add this hack to always take full length of data buffer by assuming the first offset
244+
// is always 0 which is true for Arrow Java and arrow-rs.
245+
final int len = end;
241246
offsets.getReferenceManager().retain();
242247
return Arrays.asList(maybeImportBitmap(type), offsets, importData(type, len));
243248
}

0 commit comments

Comments
 (0)