Skip to content

fix: make_array returns wrong row count for null-array input#21842

Open
mpurins wants to merge 1 commit intoapache:mainfrom
mpurins:mpurins/make-array
Open

fix: make_array returns wrong row count for null-array input#21842
mpurins wants to merge 1 commit intoapache:mainfrom
mpurins:mpurins/make-array

Conversation

@mpurins
Copy link
Copy Markdown

@mpurins mpurins commented Apr 25, 2026

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Noticed that spark array has the same issue and fixed that as well. Only now there are two almost identical make_array_inner functions and I'm not sure if those should be unified or not.

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions Bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation spark labels Apr 25, 2026
}

#[tokio::test]
async fn make_array_null_typed_column_preserves_rows() -> Result<()> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Let's remove this test as the SLT one is sufficient

use arrow::array::ListArray;

#[test]
fn make_array_inner_all_null_arrays_preserves_row_count_and_width() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same for these unit tests

} else {
// All-null inputs still need to flow through `array_array()` so rows
// are built per input row instead of collapsing to one value.
let data_type = arrays
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I feel we can get this from the return type, which is provided in the ScalarFunctionArgs in invoke_with_args, so we some plumbing we can reuse that instead of having this logic

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

Labels

core Core DataFusion crate functions Changes to functions implementation spark sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

make_array returns wrong row count for null-array input

2 participants