Skip to content

Fix case evaluation with NULL#6477

Merged
alamb merged 1 commit intoapache:mainfrom
jonahgao:main
May 30, 2023
Merged

Fix case evaluation with NULL#6477
alamb merged 1 commit intoapache:mainfrom
jonahgao:main

Conversation

@jonahgao
Copy link
Copy Markdown
Member

Which issue does this PR close?

Closes #6376.

Rationale for this change

As pointed out by @richox on #6376

zip() does not specify the behavior of null input and it doesn't check null values in its implementation.

What changes are included in this PR?

Call the prep_null_mask_filter function to eliminate NULLs.

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions Bot added core Core DataFusion crate physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt) labels May 29, 2023
Copy link
Copy Markdown
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

LGTM -- thank you @byteink

4

# issue: https://github.com/apache/arrow-datafusion/issues/6376
query I
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.

👍 matches postgres:

postgres=# select case when a = 0 then 123 end from (values(1), (0), (null)) as t(a);
 case
------

  123

(3 rows)

@alamb alamb merged commit 7f92944 into apache:main May 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Core DataFusion crate physical-expr Changes to the physical-expr crates sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CaseWhen produces incorrect output

3 participants