EeshanBembi opened a new pull request, #18137:
URL: https://github.com/apache/datafusion/pull/18137

   Fixes #18020
   
     ## Summary
     Enables `concat` function to concatenate arrays like `array_concat` while
     preserving all existing string concatenation behavior.
   
     **Before:**
     ```sql
     SELECT concat([1, 2, 3], [4, 5]);
     -- Result: [1, 2, 3][4, 5]  ❌
   ```
   
     **After**:
   ```sql
     SELECT concat([1, 2, 3], [4, 5]);
     -- Result: [1, 2, 3, 4, 5]  ✅
   ```
     Implementation
   
     - Extended concat function signature to accept array types
     - Added type detection in invoke_with_args() to delegate array operations 
to Arrow
      compute functions
     - Enhanced type coercion to handle mixed array types and empty arrays
     - Maintains full backward compatibility with string concatenation
   
     Test Coverage
   
     - ✅ Array concatenation: [1,2] + [3,4] → [1,2,3,4]
     - ✅ Empty arrays: [1,2] + [] → [1,2]
     - ✅ Nested arrays: [[1,2]] + [[3,4]] → [[1,2],[3,4]]
     - ✅ String concatenation unchanged: 'hello' + 'world' → 'helloworld'
     - ✅ Mixed type coercion: true + 42 + 'test' → 'true42test'
     - ✅ Error handling: [1,2] + 'string' → Error
   
     Approach Benefits
   
     Function-level implementation vs planner replacement:
     - Cleaner architecture (single responsibility)
     - No planner complexity
     - Better performance
     - Easier testing and maintenance


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