Skip to content

branch-4.0:[fix](fe) Fix null pointer exception in sessionVariables after upgrade #61959 - #62896

Merged
yiguolei merged 1 commit into
apache:branch-4.0from
feiniaofeiafei:fix_nullptr_sv
May 7, 2026
Merged

branch-4.0:[fix](fe) Fix null pointer exception in sessionVariables after upgrade #61959#62896
yiguolei merged 1 commit into
apache:branch-4.0from
feiniaofeiafei:fix_nullptr_sv

Conversation

@feiniaofeiafei

Copy link
Copy Markdown
Collaborator

picked from #61959

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>
@feiniaofeiafei

Copy link
Copy Markdown
CollaboratorAuthor

run buildall

2 similar comments
@feiniaofeiafei

Copy link
Copy Markdown
CollaboratorAuthor

run buildall

@feiniaofeiafei

Copy link
Copy Markdown
CollaboratorAuthor

run buildall

@yiguolei

Copy link
Copy Markdown
Contributor

skip buildall

@github-actionsgithub-actionsBot added the approved Indicates a PR has been approved by one committer. label May 7, 2026
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@yiguolei
yiguolei merged commit 9b1a764 into apache:branch-4.0May 7, 2026
31 of 33 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approvedIndicates a PR has been approved by one committer.reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@feiniaofeiafei@yiguolei