Skip to content

fix: Operator::returns_null_on_null() should include string concat (||)#22458

Merged
Dandandan merged 1 commit into
apache:mainfrom
neilconway:neilc/fix-string-concat-is-null-to-null
May 23, 2026
Merged

fix: Operator::returns_null_on_null() should include string concat (||)#22458
Dandandan merged 1 commit into
apache:mainfrom
neilconway:neilc/fix-string-concat-is-null-to-null

Conversation

@neilconway
Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

Operator::returns_null_on_null() incorrectly claimed that the string concatenation operator (||) treats NULL input as the empty string; it does not. (Note that the concat() function has the NULL->empty string behavior, but the operator does not.)

While we're here, also teach Operator::negate() that Operator::RegexMatch and Operator::RegexNotMatch are pairs, and the same for the case-insensitive versions.

What changes are included in this PR?

  • Teach Operator::returns_null_on_null() that || returns NULL on NULL inputs
  • Teach Operator::negate() that Operator::RegexMatch and Operator::RegexNotMatch are pairs; same for case-insensitive versions
  • Fix typos in comments
  • Add tests for new behavior

Are these changes tested?

Yes; new tests added.

Are there any user-facing changes?

Yes, but minor: expression simplification, outer join elimination, and other optimizer can take advantage of this to optimize queries a bit more effectively.

@github-actions github-actions Bot added logical-expr Logical plan and expressions optimizer Optimizer rules labels May 22, 2026
@Dandandan Dandandan added this pull request to the merge queue May 23, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 23, 2026
@Dandandan Dandandan added this pull request to the merge queue May 23, 2026
Merged via the queue into apache:main with commit 51b51e8 May 23, 2026
38 checks passed
@neilconway neilconway deleted the neilc/fix-string-concat-is-null-to-null branch May 25, 2026 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

logical-expr Logical plan and expressions optimizer Optimizer rules

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Operator::returns_null_on_null() incorrectly classifies string concatenation

3 participants