andygrove opened a new issue, #6981: URL: https://github.com/apache/datafusion-comet/issues/6981
### What is the problem the feature request solves? [`TypedElements::write_elements_slow` in execution/columnar_to_row.rs (L685-L824)](https://github.com/apache/datafusion-comet/blob/7d8d9b1544b734c85a93cca2cc9d5380ad70accd/native/core/src/execution/columnar_to_row.rs#L685-L824) repeats the same loop skeleton (source index, null check and `set_null_bit`, slot offset) in each of its arms. The String, LargeString, Binary and LargeBinary arms (about L735-794) and the large-Decimal128 arm (about L718-733) differ only in how the bytes are obtained: each repeats `write_bytes_padded`, the `((data_offset as i64) << 32) | len` packing and the slot write. A change to that encoding would have to be repeated five or more times. The final `_ => {}` arm also silently ignores any variant that is not handled, rather than erroring. ### Describe the potential solution - Add a helper such as `write_var_slot(buffer, array_start, slot_offset, bytes: &[u8])` that does `write_bytes_padded` and writes the packed offset/length word. - Add a loop helper that handles the null bit, so each arm only supplies a per-element closure, and collapse the four string/binary arms into one using a shared byte-slice accessor. - Replace `_ => {}` with an explicit error or `unreachable!`. `write_struct_to_buffer` and `write_struct_to_buffer_typed` in the same file appear to use the same packing and could share the helper. ### Additional context This is self-contained and a good first issue. Line references are pinned to commit 7d8d9b1544b7. -- 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]
