mrhhsg opened a new pull request, #66280:
URL: https://github.com/apache/doris/pull/66280
### What problem does this PR solve?
Issue Number: None
Related PR: None
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.
The added argument scan runs only while building a function and introduces
no per-row execution cost. Functions with custom NULL handling, typed NULL
arguments, ordinary nullable columns, and non-NULL inputs keep their existing
paths.
### Release note
Fix a backend crash when `array_zip` receives an untyped `NULL` argument.
### Check List (For Author)
- Test
- [x] Regression test
- Generated and reran `test_array_zip_array_enumerate_uniq` with an
isolated regression configuration.
- [x] Unit Test
- `./run-be-ut.sh --run
--filter=SimpleFunctionFactoryTest.test_null_literal_skips_return_type_inference`
- [x] Build
- `BUILD_TYPE=ASAN ./build.sh --be --fe`
- [x] Static/style checks
- `./build-support/clang-format.sh`
- `./build-support/check-format.sh`
- `./build-support/run-clang-tidy.sh --build-dir be/ut_build_ASAN`
- `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]