Skip to content

branch-4.1: [improvement](fe) Enhance COALESCE simplification to remove all NullLiterals #62266#62808

Merged
yiguolei merged 1 commit intobranch-4.1from
auto-pick-62266-branch-4.1
Apr 25, 2026
Merged

branch-4.1: [improvement](fe) Enhance COALESCE simplification to remove all NullLiterals #62266#62808
yiguolei merged 1 commit intobranch-4.1from
auto-pick-62266-branch-4.1

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Cherry-picked from #62266

@github-actions github-actions Bot requested a review from yiguolei as a code owner April 24, 2026 08:43
…iterals (#62266)

The existing COALESCE simplification rule in SimplifyConditionalFunction
only removed leading NullLiteral arguments. When a nullable
non-NullLiteral argument was encountered, all remaining arguments
(including trailing/interleaved NullLiterals) were preserved.
Additionally, an early exit prevented any simplification when the first
argument was a nullable non-NullLiteral.

For example, `coalesce(null, null, ..., null, i1, null)` was simplified
to `coalesce(i1, null)` instead of just `i1`.

The improved algorithm:
1. Skips ALL NullLiteral arguments (not just leading ones)
2. Truncates at the first non-nullable argument (subsequent args are
unreachable)
3. Returns the single remaining expression directly when only one is
left

### Release note

Improved COALESCE expression simplification to remove all NULL literal
arguments and truncate unreachable arguments after the first
non-nullable expression.

### Check List (For Author)

- Test: Unit Test
- Behavior changed: No
- Does this need documentation: No

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@morningman
Copy link
Copy Markdown
Contributor

run buildall

@morningman morningman force-pushed the auto-pick-62266-branch-4.1 branch from cd29809 to c23b4f8 Compare April 24, 2026 20:22
@hello-stephen
Copy link
Copy Markdown
Contributor

FE UT Coverage Report

Increment line coverage 100.00% (4/4) 🎉
Increment coverage report
Complete coverage report

@hello-stephen
Copy link
Copy Markdown
Contributor

FE Regression Coverage Report

Increment line coverage 100.00% (4/4) 🎉
Increment coverage report
Complete coverage report

@yiguolei
Copy link
Copy Markdown
Contributor

skip buildall

@github-actions
Copy link
Copy Markdown
Contributor Author

PR approved by at least one committer and no changes requested.

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label Apr 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor Author

PR approved by anyone and no changes requested.

@yiguolei yiguolei merged commit e1eb017 into branch-4.1 Apr 25, 2026
32 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants