feiniaofeiafei opened a new pull request, #61959:
URL: https://github.com/apache/doris/pull/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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to