BiteTheDDDDt opened a new pull request, #62266:
URL: https://github.com/apache/doris/pull/62266

   The existing COALESCE simplification rule in SimplifyConditionalFunction 
only removed leading NullLiteral arguments. When a nullable non-NullLiteral 
argument was encountered, all remaining arguments (including 
trailing/interleaved NullLiterals) were preserved. Additionally, an early exit 
prevented any simplification when the first argument was a nullable 
non-NullLiteral.
   
   For example, `coalesce(null, null, ..., null, i1, null)` was simplified to 
`coalesce(i1, null)` instead of just `i1`.
   
   The improved algorithm:
   1. Skips ALL NullLiteral arguments (not just leading ones)
   2. Truncates at the first non-nullable argument (subsequent args are 
unreachable)
   3. Returns the single remaining expression directly when only one is left
   
   ### Release note
   
   Improved COALESCE expression simplification to remove all NULL literal 
arguments and truncate unreachable arguments after the first non-nullable 
expression.
   
   ### Check List (For Author)
   
   - Test: Unit Test
   - Behavior changed: No
   - Does this need documentation: No
   


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