Skip to content

fix(spark): array_repeat returns repeated NULLs instead of NULL when element is NULL#21558

Merged
comphead merged 1 commit intoapache:mainfrom
buraksenn:fix-spark-array-repeat-null-element
Apr 11, 2026
Merged

fix(spark): array_repeat returns repeated NULLs instead of NULL when element is NULL#21558
comphead merged 1 commit intoapache:mainfrom
buraksenn:fix-spark-array-repeat-null-element

Conversation

@buraksenn
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

NULL behavior does not align at the moment and with this PR it is. You can see issue

What changes are included in this PR?

only check count argument for null for returning null

Are these changes tested?

yes slt tests

Are there any user-facing changes?

Now user's will be able to see NULL element is repeated as in spark

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) spark labels Apr 11, 2026
@buraksenn
Copy link
Copy Markdown
Contributor Author

This failed with:

thread 'sql::unparser::test_tpch_unparser_roundtrip' (21090) has overflowed its stack
fatal runtime error: stack overflow, aborting
error: test failed, to rerun pass `-p datafusion --test core_integration`

AFAIR this was a flaky one and it should not be related it would be great if someone can rerun the wf

Copy link
Copy Markdown
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 @buraksenn

@comphead comphead added this pull request to the merge queue Apr 11, 2026
Merged via the queue into apache:main with commit 0ab78e7 Apr 11, 2026
53 of 54 checks passed
@buraksenn buraksenn deleted the fix-spark-array-repeat-null-element branch April 14, 2026 07:51
Rich-T-kid pushed a commit to Rich-T-kid/datafusion that referenced this pull request Apr 21, 2026
…element is NULL (apache#21558)

## Which issue does this PR close?
- Closes apache#21512.

## Rationale for this change
NULL behavior does not align at the moment and with this PR it is. You
can see issue

## What changes are included in this PR?
only check count argument for null for returning null

## Are these changes tested?
yes slt tests

## Are there any user-facing changes?
Now user's will be able to see NULL element is repeated as in spark
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

spark sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: datafusion-spark array_repeat incorrectly returns NULL when element is NULL

2 participants