Uh oh!
There was an error while loading. Please reload this page.
[fix](fe) Fix null pointer exception in sessionVariables after upgrade - #61959
Merged
Conversation
Thearas
commented
Mar 31, 2026
Contributor
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
…e from 4.0.2 After upgrading from 4.0.2 to 4.0.4+, executing SHOW CREATE MATERIALIZED VIEW throws a NullPointerException. The root cause is that the sessionVariables field was newly added in MTMV.java after 4.0.2. In 4.0.2, materialized views did not persist this field, so after upgrade, the deserialized sessionVariables is null. However, ShowCreateMTMVInfo.java:93 directly calls mtmv.getSessionVariables().toString() without null pointer protection, causing NPE. Fixed NullPointerException when executing SHOW CREATE MATERIALIZED VIEW after upgrading from version 4.0.2 to 4.0.4+. - Test: Unit tests added and passed - Added SessionVariablesNullFixTest with comprehensive test cases - Test cases verify null sessionVariables initialization in gsonPostProcess - All tests pass in FE build - Behavior changed: No (internal fix only) - Does this need documentation: No Modified classes to initialize sessionVariables to empty HashMap in gsonPostProcess method: 1. MTMV.java - Already implemented GsonPostProcessable, added null check 2. View.java - Already implemented GsonPostProcessable, added null check 3. AliasFunction.java - Added GsonPostProcessable implementation 4. Column.java - Already implemented GsonPostProcessable, added null check 5. MaterializedIndexMeta.java - Already implemented GsonPostProcessable, added null check This prevents NPE when calling toString() on null sessionVariables during deserialization of objects created with 4.0.2 or earlier versions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
feiniaofeiafeiforce-pushed
the
fix_nullptr
branch
from
March 31, 2026 12:11
066c571 to
c857b43Comparefeiniaofeiafei
commented
Mar 31, 2026
CollaboratorAuthor
run buildall |
doris-robot
commented
Mar 31, 2026
TPC-H: Total hot run time: 26499 ms |
doris-robot
commented
Mar 31, 2026
TPC-DS: Total hot run time: 169039 ms |
hello-stephen
commented
Mar 31, 2026
Contributor
FE UT Coverage ReportIncrement line coverage |
feiniaofeiafei
commented
Apr 1, 2026
CollaboratorAuthor
run cloud_p0 |
feiniaofeiafei
commented
Apr 1, 2026
CollaboratorAuthor
run nonConcurrent |
feiniaofeiafei
commented
Apr 2, 2026
CollaboratorAuthor
run cloud_p0 |
1 similar comment
feiniaofeiafei
commented
Apr 2, 2026
CollaboratorAuthor
run cloud_p0 |
morrySnow
approved these changes
Apr 2, 2026
Contributor
PR approved by at least one committer and no changes requested. |
Contributor
PR approved by anyone and no changes requested. |
feiniaofeiafei
commented
Apr 2, 2026
CollaboratorAuthor
run cloud_p0 |
Uh oh!
There was an error while loading. Please reload this page.
iaorekhov-1980 pushed a commit
to iaorekhov-1980/doris
that referenced
this pull request
Apr 7, 2026
apache#61959) ## What problem does this PR solve? After upgrading from 4.0.2 to 4.0.4+, executing SHOW CREATE MATERIALIZED VIEW throws a NullPointerException. The root cause is that the sessionVariables field was newly added in MTMV.java after 4.0.2. In 4.0.2, materialized views did not persist this field, so after upgrade, the deserialized sessionVariables is null. However, ShowCreateMTMVInfo.java:93 directly calls mtmv.getSessionVariables().toString() without null pointer protection, causing NPE. ## Solution Modified gsonPostProcess() method in 5 classes to initialize sessionVariables to empty HashMap during deserialization: - MTMV.java - Added null check for sessionVariables - View.java - Added null check for sessionVariables - AliasFunction.java - Implemented GsonPostProcessable and added null check - Column.java - Added null check for sessionVariables - MaterializedIndexMeta.java - Added null check for sessionVariables ## Release note Fixed NullPointerException when executing SHOW CREATE MATERIALIZED VIEW after upgrading from version 4.0.2 to 4.0.4+. ## Test - Unit tests added (SessionVariablesNullFixTest) with comprehensive coverage - All existing tests pass - FE build successful Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
feiniaofeiafei added a commit
to feiniaofeiafei/doris
that referenced
this pull request
Apr 28, 2026
apache#61959) After upgrading from 4.0.2 to 4.0.4+, executing SHOW CREATE MATERIALIZED VIEW throws a NullPointerException. The root cause is that the sessionVariables field was newly added in MTMV.java after 4.0.2. In 4.0.2, materialized views did not persist this field, so after upgrade, the deserialized sessionVariables is null. However, ShowCreateMTMVInfo.java:93 directly calls mtmv.getSessionVariables().toString() without null pointer protection, causing NPE. Modified gsonPostProcess() method in 5 classes to initialize sessionVariables to empty HashMap during deserialization: - MTMV.java - Added null check for sessionVariables - View.java - Added null check for sessionVariables - AliasFunction.java - Implemented GsonPostProcessable and added null check - Column.java - Added null check for sessionVariables - MaterializedIndexMeta.java - Added null check for sessionVariables Fixed NullPointerException when executing SHOW CREATE MATERIALIZED VIEW after upgrading from version 4.0.2 to 4.0.4+. - Unit tests added (SessionVariablesNullFixTest) with comprehensive coverage - All existing tests pass - FE build successful Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Closed
Closed
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.
What problem does this PR solve?
After upgrading from 4.0.2 to 4.0.4+, executing SHOW CREATE MATERIALIZED VIEW throws a NullPointerException. The root cause is that the sessionVariables field was newly added in MTMV.java after 4.0.2. In 4.0.2, materialized views did not persist this field, so after upgrade, the deserialized sessionVariables is null. However, ShowCreateMTMVInfo.java:93 directly calls mtmv.getSessionVariables().toString() without null pointer protection, causing NPE.
Solution
Modified gsonPostProcess() method in 5 classes to initialize sessionVariables to empty HashMap during deserialization:
Release note
Fixed NullPointerException when executing SHOW CREATE MATERIALIZED VIEW after upgrading from version 4.0.2 to 4.0.4+.
Test