JuieeAJaviya opened a new pull request, #19632:
URL: https://github.com/apache/datafusion/pull/19632
## Rationale for this change
The `concat()` scalar function currently treats array inputs as their
string display representations, producing incorrect results such as
`[1,2,3][4,5]`.
DataFusion already provides correct array concatenation semantics via
`array_concat()`. Aligning `concat()` behavior for array inputs with
existing SQL expectations improves correctness and consistency while
avoiding duplicated logic.
## What changes are included in this PR?
- Detect when all arguments passed to `concat()` are arrays
- Delegate execution to the existing `array_concat()` implementation
- Add a unit test to ensure `concat(array, array)` behaves the same as
`array_concat(array, array)`
- Preserve existing string concatenation behavior
## Are these changes tested?
Yes.
A new unit test has been added to validate correct array concatenation
and to prevent regression. Existing tests continue to pass.
## Are there any user-facing changes?
Yes.
`concat()` now returns correctly merged arrays when all inputs are arrays,
matching the behavior of `array_concat()`. Existing string behavior is
unchanged.
--
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]