[fix](mtmv) Add null-safety to getBaseViewsOneLevel for backward compatibility#64412
Open
yujun777 wants to merge 5 commits into
Open
[fix](mtmv) Add null-safety to getBaseViewsOneLevel for backward compatibility#64412yujun777 wants to merge 5 commits into
yujun777 wants to merge 5 commits into
Conversation
…atibility getBaseViewsOneLevel() could return null when an MTMV was created before the baseViewsOneLevel field was introduced, causing NPE when querying information_schema.view_dependency via Stream.concat(). Key changes: - getBaseViewsOneLevel() now falls back to baseViews when baseViewsOneLevel is null, consistent with getBaseTablesOneLevel() Unit Test: - MTMVRelationTest.testMTMVRelation
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
Author
|
run buildall |
morrySnow
reviewed
Jun 11, 2026
| public Set<BaseTableInfo> getBaseViewsOneLevel() { | ||
| return baseViewsOneLevel; | ||
| // For compatibility, previously created MTMV may not have baseViewsOneLevel | ||
| return baseViewsOneLevel == null ? baseViews : baseViewsOneLevel; |
Contributor
There was a problem hiding this comment.
add a gsonpostprocessor assign empty set to baseViewsOneLevel if it is null?
Contributor
Author
There was a problem hiding this comment.
这个文件中前面两个函数都是用一样的写法的。 保持一致的风格 ?
Contributor
TPC-H: Total hot run time: 29273 ms |
Contributor
TPC-DS: Total hot run time: 168946 ms |
…w-dependency-npe
Move the null-safety fallback from getBaseViewsOneLevel() to gsonPostProcess(), so the compatibility fix is applied once at deserialization time rather than on every getter call. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
run buildall |
Avoid shared reference between baseViews and baseViewsOneLevel by creating a new HashSet copy. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Fall back to empty set instead of null when baseViews is also null. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
Author
|
run buildall |
Contributor
TPC-H: Total hot run time: 29165 ms |
Contributor
TPC-H: Total hot run time: 28985 ms |
Contributor
TPC-DS: Total hot run time: 169321 ms |
Contributor
TPC-DS: Total hot run time: 168542 ms |
Contributor
FE UT Coverage ReportIncrement line coverage |
Contributor
FE Regression Coverage ReportIncrement line coverage |
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 free
to 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.
Introduced by #56423, the field baseViewsOneLevel may be null for MTMVs created before that PR. This causes NPE when querying information_schema.view_dependency:
Cannot invoke java.util.Set.stream() because the return value of org.apache.doris.mtmv.MTMVRelation.getBaseViewsOneLevel() is null
baseViewsOneLevel is currently only used for tablefunction/MetadataGenerator, so this change is safe.