andygrove opened a new pull request, #3658: URL: https://github.com/apache/datafusion-comet/pull/3658
## Summary - Replace `from_raw_parts` + `try_into().unwrap()` + `from_le_bytes()` with direct aligned pointer dereferences (`*(addr as *const T)`) in all `SparkUnsafeObject` trait accessors (`get_byte`, `get_short`, `get_int`, `get_long`, `get_float`, `get_double`, `get_date`, `get_timestamp`) - Apply the same optimization to `SparkUnsafeArray::new` element count read - Both `SparkUnsafeRow` and `SparkUnsafeArray` guarantee natural alignment for field access, so unaligned reads are unnecessary ## Rationale Spark's `UnsafeRow` fields are at 8-byte aligned offsets (bitset width is a multiple of 8, each slot is 8 bytes, JVM allocates aligned memory). `UnsafeArray` elements are also naturally aligned (header is 8-byte aligned, elements are at `element_size` stride). The previous `from_raw_parts` + `try_into().unwrap()` + `from_le_bytes` pattern added three layers of abstraction per read that compiled to unnecessary overhead. These accessors are on the hottest path in row-to-columnar conversion used by JVM shuffle. ## Test plan - [x] `cargo clippy --all-targets --workspace -- -D warnings` passes - [x] `cargo test --no-run` compiles successfully - [ ] Existing row-to-columnar tests cover these code paths -- 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]
