Skip to content

Conversation

@github-actions
Copy link
Contributor

Cherry-picked from #59105

Related PR: #22203

Problem Summary:

This pull request refines the logic in the `EliminateEmptyRelation`
rewrite rule, focusing on how set operations (`UNION` and `EXCEPT`)
handle empty relations in query plans. The changes improve efficiency
and code clarity by processing only when necessary, optimizing builder
usage, and simplifying project and aggregate node construction.

**Set Operation Handling Improvements:**

* Updated the logic for `UNION` nodes to only process and eliminate
empty relation children when at least one is present, reducing
unnecessary computation. Builders are now initialized with expected
sizes for efficiency, and redundant code for handling constant
expressions was removed.
* Improved handling of `EXCEPT` nodes by checking for empty relations
only among the right-hand children, and optimizing builder
initialization. The construction of aggregate and project nodes now uses
the correct outputs directly, streamlining the process.
@github-actions github-actions bot requested a review from yiguolei as a code owner December 18, 2025 02:32
@hello-stephen
Copy link
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@dataroaring dataroaring reopened this Dec 18, 2025
@hello-stephen
Copy link
Contributor

run buildall

@yiguolei yiguolei merged commit 41e95bd into branch-4.0 Dec 18, 2025
24 of 27 checks passed
@github-actions github-actions bot deleted the auto-pick-59105-branch-4.0 branch December 18, 2025 09:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants