1fanwang opened a new pull request, #25714:
URL: https://github.com/apache/datafusion/pull/25714

   ## Which issue does this PR close?
   
   - Closes https://github.com/apache/datafusion/issues/18020.
   
   ## Rationale for this change
   
   `concat(make_array(1, 2, 3), make_array(4, 5))` currently treats both arrays 
as strings and returns `[1, 2, 3][4, 5]`. Users expect array arguments to 
behave like `array_concat` and return a single array.
   
   After this change, `concat` keeps the existing string behavior and returns 
`[1, 2, 3, 4, 5]` for array inputs.
   
   ## What changes are included in this PR?
   
   - Adds a function rewrite for `concat(array, ...)` to call 
`array_concat(...)`.
   - Registers that rewrite for default sessions and for registries that call 
`datafusion_functions_nested::register_all`.
   - Adds sqllogictest coverage for array and null-array `concat` calls.
   
   ## What is the testing strategy for this PR?
   
   Before the fix:
   
   ```text
   select concat(make_array(1, 2, 3), make_array(4, 5));
   [1, 2, 3][4, 5]
   ```
   
   After the fix:
   
   ```text
   select concat(make_array(1, 2, 3), make_array(4, 5));
   [1, 2, 3, 4, 5]
   ```
   
   ```text
   cargo test -p datafusion-sqllogictest --test sqllogictests --profile ci -j6 
-- array/array_concat.slt
   Progress: 1/1 files completed (100%)
   
   cargo test -p datafusion-functions-nested --profile ci -j6 --lib
   test result: ok. 151 passed; 0 failed
   ```
   
   ## Are there any user-facing changes?
   
   Yes. `concat` now returns array concatenation results when all arguments are 
arrays or null arrays.
   


-- 
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]

Reply via email to