Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix case evaluation with NULL #6477

Merged
merged 1 commit into from
May 30, 2023
Merged

Fix case evaluation with NULL #6477

merged 1 commit into from
May 30, 2023

Conversation

jonahgao
Copy link
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 Physical Expressions sqllogictest SQL Logic Tests (.slt) labels May 29, 2023
Copy link
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

@@ -673,6 +673,14 @@ NULL
NULL
4

# issue: https://github.com/apache/arrow-datafusion/issues/6376
query I
Copy link
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 Physical Expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CaseWhen produces incorrect output
3 participants