Support array concat with different dimensions
- Dominant language
- Rust
- Stars
- 9.3k
- Forks
- 2.4k
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 344
Description
### Is your feature request related to a problem or challenge?
> Concatenates the two arrays. Concatenating a null or empty array is a no-op; otherwise the arrays must have the same number of dimensions (as illustrated by the first example) or **differ in number of dimensions by one (as illustrated by the
second)**. Ref https://www.postgresql.org/docs/current/functions-array.html
Concat with the same number of dimensions is already supported, but the dimensions differ by one is not.
- [ ] array_concat
- [ ] array concat op (lhs || rhs)
# Same dimensions concat
select array_concat(make_array([1,2], [3,4]), make_array([5, 6]))
> [[1, 2], [3, 4], [5, 6]]
# Diff 1 concat
select array_concat(make_array([1,2], [3,4]), make_array(5, 6))
> [[1, 2], [3, 4], [5, 6]]
select array_concat(make_array(5, 6), make_array([1,2], [3,4]))
> [[1, 2], [3, 4], [5, 6]]
Three of the result should be the same
### Describe the solution you'd like
We can add an additional dimension to the lower dimension array, then contact them
### Describe alternatives you've considered
Anything else that works
### Additional context
I plan to work on this
Contributor guide
Research direction
Start at the array_concat entry point and the array concat operator (lhs || rhs), using the PostgreSQL array-concatenation examples in the issue as behavioral reference. Verify both operand orders and the existing same-dimension behavior; done means both function and operator support one-dimension differences, including the shown outputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, sql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100