Skip to content

Support array concat with different dimensions #6849

Open
@jayzhan211

Description

@jayzhan211

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions