Uh oh!
There was an error while loading. Please reload this page.
branch-4.1:[fix](mtmv) Avoid invalid slot cast in MV null-reject compensation (#66613) - #67266
Merged
Merged
Conversation
…pache#66613) ### What problem does this PR solve? Related PR: apache#43539, apache#62492, apache#63268 Problem Summary: When an INNER JOIN query is matched against a LEFT OUTER JOIN materialized view, the rewrite must prove that the nullable side is null-rejected. The MV rule shuttles the nullable-side output Slots through the view plan lineage to normalize Project and Alias outputs before selecting an `IS NOT NULL` compensation Slot. `AbstractMaterializedViewRule.getShuttledRequireNoNullableViewSlots()` assumed that `ExpressionUtils.shuttleExpressionWithLineage()` always returns `Slot` values and unconditionally used `Slot.class::cast`. The API returns general `Expression` values. Expression JOIN keys such as CAST equality can introduce helper projections whose lineage expands to `Cast`, causing a `ClassCastException` during MV rewrite. This is a conservative crash fix, not transparent rewrite support for CAST or arbitrary derived expressions. If no usable Slot remains after lineage expansion, the existing proof checks return invalid and the MV rewrite safely falls back to base tables. ### Release note Fixed an internal `ClassCastException` during materialized view rewrite for expression-based join keys. Unsupported derived-expression lineage now falls back safely. ### Check List (For Author) - Test: Unit Test - `NullRejectInferenceTest` - Behavior changed: Yes, unsupported derived-expression lineage falls back instead of throwing - Does this need documentation: No
hello-stephen
commented
Aug 28, 2026
Contributor
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
seawinde
commented
Aug 28, 2026
MemberAuthor
run buildall |
yiguolei
approved these changes
Aug 28, 2026
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
pr: #66613
commitId: a97548f