neilconway opened a new pull request, #20553: URL: https://github.com/apache/datafusion/pull/20553
## Which issue does this PR close? - Closes #20551. - Closes #20552. ## Rationale for this change `array_to_string` did a lot of unnecessary allocations. Rewriting the function to avoid those allocations yields around a 50% improvement for numeric arrays, and a further ~30% improvement for arrays of strings. ## What changes are included in this PR? * Add benchmark for `array_to_string` * Move nested functions to top-level * Get rid of some unnecessary macros * Borrow instead of cloning on recursion * Reuse a single `String` buffer across rows via `buf.clear()`, instead of allocating fresh * Write directly to the output buffer via `write!`, instead of allocating via `x.to_string()` + `push_str` * Specialize for string arrays to skip `write!` overhead and use `push_str` directly * Add support for arrays of `decimal` * Improve docs ## Are these changes tested? Yes, and benchmarked. ## Are there any user-facing changes? No. -- 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]
