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

   ### Background
   
   Function names can omit a database name, as built-in functions normally do. 
Function expressions and materialized view partition metadata include these 
names in their hash codes.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: None
   PR Type: Bugfix
   
   Problem Summary:
   
   Formatting materialized view partition metadata while recording a rewrite 
failure can throw a NullPointerException when the partition expression contains 
an unqualified function such as `date_trunc`. Handle the absent database name 
in `FunctionName.hashCode()` so the existing diagnostic path completes normally.
   
   ### Details
   
   - **Frequency:** Deterministic when hashing an unqualified function name, 
including through MV partition metadata's default string representation.
   - **Root cause:** Unqualified function names have a null database field, but 
hashing unconditionally calls `db.toLowerCase()`.
   - **Why existing tests missed it:** Existing expression equality tests 
exercise function-call equality without hashing unqualified function names or 
formatting MV partition metadata containing them.
   - **Behavior change:** Hashing an unqualified name now succeeds instead of 
throwing; MV rewrite behavior is unchanged.
   - **Fix:** Hash a null database as null while preserving the existing 
calculation for qualified function names.
   - **Other paths and branches:** Fixing the shared implementation also covers 
direct collection use and expression hashing. This PR targets master; no 
release branches are changed.
   
   ### Testing
   
   - Local `./build.sh --fe`: passed, including Checkstyle.
   - Local `./run-fe-ut.sh --run org.apache.doris.catalog.FunctionNameTest`: 4 
tests passed, 0 failures/errors/skips. Covers unqualified and qualified names, 
case-insensitive collection lookup, function-expression hashing, and formatting 
MV partition metadata containing `date_trunc`.
   - The complete SQL reproduction was not run against a live cluster.
   
   ### Release note
   
   Fix a NullPointerException when hashing unqualified function names, 
including when recording materialized view rewrite failure diagnostics.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No
   - Pre-submission status: Ready
   


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