You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@arrow.apache.org by "hellishfire (via GitHub)" <gi...@apache.org> on 2024/05/16 02:50:59 UTC

[I] [Java][C] sliced RecordBatch offset info is lost when imported from c-data [arrow]

hellishfire opened a new issue, #41682:
URL: https://github.com/apache/arrow/issues/41682

   ### Describe the bug, including details regarding any error messages, version, and platform.
   
   Reproduced on latest arrow release (16.0)
   
   When importing a sliced RecordBatch from c to java
   
   On c side:
   auto sliced_record_batch = original_record_batch->Slice(/*offset=*/8, /*length=*/2);
   arrow::ExportRecordBatch(sliced_record_batch, arrow_array_ptr);
   
   On java side:
   ArrowArray arrowArray = ArrowArray.allocateNew(allocator);
   Data.importIntoVectorSchemaRoot(allocator, arrowArray, vectorSchemaRoot, null);
   
   The imported vectorSchemaRoot maintains the correct length(which is 2), but the offset info (which is 8) is not respected, hence the content of the imported vectorSchemaRoot points to the first 2 rows of the original_record_batch.
   
   I'm not familiar with arrow code, but it seems that the offset info is actually present in org.apache.arrow.c.ArrowArray.Snapshot, but org.apache.arrow.c.ArrayImporter ignores the offset in org.apache.arrow.c.ArrayImporter.doImport(ArrowArray.Snapshot)
   
   
   ### Component(s)
   
   Java


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@arrow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java][C] sliced RecordBatch offset info is lost when imported from c-data [arrow]

Posted by "hellishfire (via GitHub)" <gi...@apache.org>.
hellishfire commented on issue #41682:
URL: https://github.com/apache/arrow/issues/41682#issuecomment-2113930191

   > Java doesn't really have a concept of slicing, so either this needs to copy the data (at least for things that can't easily be sliced, like the validity buffer) or it should error on import.
   
   I take a quick look at the slice() method of VectorSchemaRoot, which slices the data buffer, and slice or copy validity buffer


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java][C] sliced RecordBatch offset info is lost when imported from c-data [arrow]

Posted by "vibhatha (via GitHub)" <gi...@apache.org>.
vibhatha commented on issue #41682:
URL: https://github.com/apache/arrow/issues/41682#issuecomment-2113985057

   I will try to reproduce this and evaluate the approach suggested by @lidavidm. I will probably need some time to try this out. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java][C] sliced RecordBatch offset info is lost when imported from c-data [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #41682:
URL: https://github.com/apache/arrow/issues/41682#issuecomment-2113920997

   Java doesn't really have a concept of slicing, so either this needs to copy the data (at least for things that can't easily be sliced, like the validity buffer) or it should error on import.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java][C] sliced RecordBatch offset info is lost when imported from c-data [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #41682:
URL: https://github.com/apache/arrow/issues/41682#issuecomment-2113961717

   CC @vibhatha 
   
   We also have to traverse recursively since child arrays can have their own offset


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java][C] sliced RecordBatch offset info is lost when imported from c-data [arrow]

Posted by "hellishfire (via GitHub)" <gi...@apache.org>.
hellishfire commented on issue #41682:
URL: https://github.com/apache/arrow/issues/41682#issuecomment-2113948678

   > Yes, but that's different in intent than the C++ version (which just tracks an offset). Here it means we can't do a 0 copy import.
   
   I understand that, but IMO data correctness comes before performance, so a copy of validity buffer is tolerable in this case?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Java][C] sliced RecordBatch offset info is lost when imported from c-data [arrow]

Posted by "lidavidm (via GitHub)" <gi...@apache.org>.
lidavidm commented on issue #41682:
URL: https://github.com/apache/arrow/issues/41682#issuecomment-2113934843

   Yes, but that's different in intent than the C++ version (which just tracks an offset). Here it means we can't do a 0 copy import.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org