andygrove commented on code in PR #2052:
URL: https://github.com/apache/datafusion-comet/pull/2052#discussion_r2246069765


##########
native/core/src/execution/jni_api.rs:
##########
@@ -341,10 +341,29 @@ fn prepare_output(
         let mut i = 0;
         while i < results.len() {
             let array_ref = 
results.get(i).ok_or(CometError::IndexOutOfBounds(i))?;
-            array_ref
-                .to_data()
-                .move_to_spark(array_addrs[i], schema_addrs[i])?;
 
+            if array_ref.offset() != 0 {
+                // https://github.com/apache/datafusion-comet/issues/2051
+                // Bug with non-zero offset FFI, so take to a new array which 
will have an offset of 0.
+                let indices = UInt32Array::from((0..num_rows as 
u32).collect::<Vec<u32>>());
+                let new_array = take(
+                    array_ref,
+                    &indices,
+                    Some(TakeOptions {
+                        check_bounds: false,

Review Comment:
   Makes sense



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to