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

   ### What problem does this PR solve?
   
   Cherry-pick #66280 to branch-4.1.
   
   Issue Number: None
   
   Related PR: #66280
   
   Problem Summary:
   
   When constant folding is skipped, an untyped `NULL` argument reaches the 
backend as a nullable `UInt8` placeholder marked as a null literal. 
`FunctionBuilderImpl` stripped the nullable wrapper and invoked 
function-specific return type inference, so functions such as `array_zip` could 
interpret that placeholder as an array and dereference a null type pointer 
during prepare.
   
   Restore the generic `Nullable(Nothing)` short circuit for null literals 
before function-specific return type inference. The sentinel lets the builder 
use the FE-planned nullable result type, while the existing default NULL 
execution path produces the typed NULL result. Add focused builder unit 
coverage and SQL regression coverage for folded and non-folded NULL arguments.
   
   Conflict resolution note: the only conflict was in 
`be/test/exprs/function/simple_function_factory_test.cpp`, because branch-4.1 
does not contain the `test_bitmap_count_new_version_return_type` test (and its 
`data_type_bitmap.h` include) from another master PR. Those unrelated parts 
were dropped; the rest of the change is identical to the master commit.
   
   ### Release note
   
   Fix a backend crash when `array_zip` receives an untyped `NULL` argument.
   
   ### Check List (For Author)
   
   - Test
       - [x] Regression test
           - `test_array_zip_array_enumerate_uniq` (cases added in #66280)
       - [x] Unit Test
           - `./run-be-ut.sh --run --filter=SimpleFunctionFactoryTest.*`
       - [x] Build
       - [x] Static/style checks
           - `clang-format` on changed files, `git diff --check`
       - [ ] Manual test (add detailed scripts or steps below)
       - [ ] No need to test or manual test. Explain why:
           - [ ] This is a refactor/code format and no logic has been changed.
           - [ ] Previous test can cover this change.
           - [ ] No code files have been changed.
           - [ ] Other reason
   
   - Behavior changed:
       - [ ] No.
       - [x] Yes. `array_zip` with an untyped `NULL` now returns `NULL` instead 
of crashing the backend when constant folding is skipped.
   
   - Does this need documentation?
       - [x] No.
       - [ ] Yes.
   


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