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


##########
native/core/src/execution/jni_api.rs:
##########
@@ -952,6 +952,7 @@ pub unsafe extern "system" fn 
Java_org_apache_comet_Native_columnarToRowConvert(
 ) -> jni::sys::jobject {
     try_unwrap_or_throw(&e, |mut env| {
         // Get the context
+        debug_assert!(c2r_handle != 0, "columnarToRowConvert: c2r_handle is 
null");

Review Comment:
   `jlong` is a signed 64-bit integer, so yes, `c2r_handle` can technically be 
negative since memory addresses above 2^63 appear as negative values when 
stored in a signed long. However, the only invalid value we need to check for 
is 0 (null pointer). Negative values are valid memory addresses on 64-bit 
systems.



##########
native/core/src/execution/columnar_to_row.rs:
##########
@@ -624,6 +624,16 @@ impl<'a> TypedElements<'a> {
                 let values_slice = $arr.values();
                 let byte_len = num_elements * $elem_size;
                 let src_start = start_idx * $elem_size;
+                debug_assert!(
+                    src_start + byte_len <= values_slice.len() * $elem_size,
+                    "bulk_copy_range: source slice out of bounds: 
src_start={}, byte_len={}, values_len={}",

Review Comment:
   Good idea, done.



-- 
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