-
Notifications
You must be signed in to change notification settings - Fork 314
feat: Enable native c2r by default, add debug asserts #3649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
bd21d70
Enable native c2r
andygrove 529a655
change nodeName
andygrove 264360e
am update golden files
andygrove d949cac
enable debug assertions in CI profile
andygrove 504ea28
feat: enable RUST_BACKTRACE in CI and add elem_size to debug assert
andygrove 59c0214
feat: set panic=unwind in CI profile to capture debug assertion messages
andygrove 44fe20c
Merge remote-tracking branch 'apache/main' into enable-native-c2r
andygrove File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -972,6 +972,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"); | ||
| let ctx = (c2r_handle as *mut ColumnarToRowContext) | ||
| .as_mut() | ||
| .ok_or_else(|| CometError::Internal("Null columnar to row context".to_string()))?; | ||
|
|
@@ -989,6 +990,17 @@ pub unsafe extern "system" fn Java_org_apache_comet_Native_columnarToRowConvert( | |
| let array_ptr = array_addrs_elements[i] as *mut FFI_ArrowArray; | ||
| let schema_ptr = schema_addrs_elements[i] as *mut FFI_ArrowSchema; | ||
|
|
||
| debug_assert!( | ||
| !array_ptr.is_null(), | ||
| "columnarToRowConvert: null array pointer at index {}", | ||
| i | ||
| ); | ||
| debug_assert!( | ||
| !schema_ptr.is_null(), | ||
| "columnarToRowConvert: null schema pointer at index {}", | ||
| i | ||
| ); | ||
|
|
||
| // Take ownership of the FFI structures | ||
| let ffi_array = std::ptr::read(array_ptr); | ||
| let ffi_schema = std::ptr::read(schema_ptr); | ||
|
|
@@ -1001,6 +1013,11 @@ pub unsafe extern "system" fn Java_org_apache_comet_Native_columnarToRowConvert( | |
| } | ||
|
|
||
| // Convert columnar to row | ||
| debug_assert!( | ||
| num_rows >= 0, | ||
| "columnarToRowConvert: num_rows is negative: {}", | ||
| num_rows | ||
| ); | ||
| let (buffer_ptr, offsets, lengths) = ctx.convert(&arrays, num_rows as usize)?; | ||
|
|
||
| // Create Java int arrays for offsets and lengths | ||
|
|
@@ -1037,6 +1054,7 @@ pub unsafe extern "system" fn Java_org_apache_comet_Native_columnarToRowClose( | |
| c2r_handle: jlong, | ||
| ) { | ||
| try_unwrap_or_throw(&e, |_env| { | ||
| debug_assert!(c2r_handle != 0, "columnarToRowClose: c2r_handle is null"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same |
||
| if c2r_handle != 0 { | ||
| let _ctx: Box<ColumnarToRowContext> = | ||
| Box::from_raw(c2r_handle as *mut ColumnarToRowContext); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can
c2r_handlebe negative?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jlongis a signed 64-bit integer, so yes,c2r_handlecan 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.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the AI response. Claude didn't ask me first 😞