andygrove opened a new issue, #26304: URL: https://github.com/apache/datafusion/issues/26304
### Is your feature request related to a problem or challenge? `datafusion-functions` has two near-identical sets of `Concat` builders, about 230 lines each: - [binaries.rs#L28-L257](https://github.com/apache/datafusion/blob/0d79252f61bd8777990b2749c216ffd07079c30d/datafusion/functions/src/binaries.rs#L28-L257) - [strings.rs#L67-L311](https://github.com/apache/datafusion/blob/0d79252f61bd8777990b2749c216ffd07079c30d/datafusion/functions/src/strings.rs#L67-L311) Both contain an offset-based builder and a view builder. The `with_capacity`, `append_offset` and `finish` bodies and the 7-arm `ColumnarValueRef` match in `write` differ only in the target array type, a UTF-8 check on scalars, and `.as_bytes()` on string values. The view builders' `append_offset` (`make_view`, the 12-byte inline threshold and the `u32` offset overflow check) is identical in both, so any fix to the view layout logic has to be made twice. ### Describe the solution you'd like - Introduce one byte-oriented builder parameterised over the output array type (a small trait providing the data type, the final array construction, and a scalar-validation hook). - Add a helper on `ColumnarValueRef` such as `value_bytes(i) -> Option<&[u8]>` so the 7-arm match collapses to one call. - Share the view-append logic between `ConcatBinaryViewBuilder` and `ConcatStringViewBuilder`, keeping only the type-specific `finish()` and its SAFETY comments separate. ### Describe alternatives you've considered Share only the view-builder `append_offset`, which is the most delicate duplicated piece. ### Additional context Line references are pinned to commit 0d79252f61bd. -- 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]
