Skip to content

fix: arrays_zip/list_zip allow single array argument #21047

Open
hsiang-c wants to merge 3 commits intoapache:mainfrom
hsiang-c:single_arg_arrays_zip
Open

fix: arrays_zip/list_zip allow single array argument #21047
hsiang-c wants to merge 3 commits intoapache:mainfrom
hsiang-c:single_arg_arrays_zip

Conversation

@hsiang-c
Copy link
Contributor

Which issue does this PR close?

Rationale for this change

Align DataFusion's arrays_zip implementation w/ DuckDB and Spark

What changes are included in this PR?

  • Allow single array argument
  • Update user doc and fix a few examples

Are these changes tested?

Yes, by sqllogictest

Are there any user-facing changes?

Yes, I modified user doc.

@github-actions github-actions bot added documentation Improvements or additions to documentation sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Mar 18, 2026
Copy link
Contributor

@comphead comphead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hsiang-c the PR looks good to me
Please add also tests with some unary edge cases

arrays_zip(null), arrays_zip(array()), arrays_zip(array(null))


# column-level test with single argument
query ?
select arrays_zip(a) from (values ([1, 2], [10, 20]), (null, [30, 40]), ([5, 6], null)) as t(a, b);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test on column a

[{1: 5}, {1: 6}]

query ?
select arrays_zip(b) from (values ([1, 2], [10, 20]), (null, [30, 40]), ([5, 6], null)) as t(a, b);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test on column b

@hsiang-c
Copy link
Contributor Author

@comphead Added, thank you for your review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

arrays_zip/list_zip should allow single array argument

2 participants