mrhhsg opened a new pull request, #71412:
URL: https://github.com/apache/doris/pull/71412
### What problem does this PR solve?
Issue Number: None
Related PR: #68114
Cherry-picked from #68114 (commit 74ae7d20b202afca27dc035f910d5fba6fefdea6)
to `branch-4.2`.
When constant folding is skipped, `element_at(NULL, index)` reaches the BE
with a bare null-literal container rather than an ARRAY or MAP type. The
existing type resolution treats its mock UInt8 type as BOOL and rejects the
expression instead of returning NULL.
### Changes
- Recognize bare null-literal containers before ARRAY/MAP return-type
resolution and resolve them to `Nullable(Nothing)`.
- Return a constant NULL result with exactly `input_rows_count` logical rows
before complex-column handling.
- Keep the existing ARRAY/MAP/STRUCT paths unchanged and include the
`DataTypeNothing` definition directly.
- Retain the upstream NULL-container unit and SQL regression coverage. Adapt
only the required unit-test helper and direct includes for `branch-4.2`; remove
a redundant trailing blank line from the expected output without changing
result values.
### Release note
Fix `element_at` rejecting a bare NULL container when constant folding is
skipped.
### Validation
- Release FE/BE build: `FE_MAVEN_THREADS=8 DISABLE_BE_JAVA_EXTENSIONS=OFF
./build.sh --be --fe -j 48` passed, including default Checkstyle and Java
runtime packaging.
- ASAN BE unit tests: `./run-be-ut.sh --run
--filter=function_array_element_test.* -j 48` passed (2/2).
- SQL regression: `test_element_at_null_container` under
`query_p0/sql_functions/array_functions`, executed with
`./run-regression-test.sh` against an isolated single-FE/single-BE
configuration, passed (1 suite, 5 result groups; 0 failed/fatal/skipped).
- `clang-format --dry-run --Werror
be/src/exprs/function/array/function_array_element.h
be/test/exprs/function/function_array_element_test.cpp` passed.
- `git diff --check` passed for the complete patch.
Full FE unit tests, the full SQL regression suite, multi-BE/mixed-version
testing and performance benchmarks were not run.
### Check List (For Author)
- Test:
- [x] Regression test
- [x] Unit Test
- Behavior changed:
- [x] Yes. A bare NULL container returns NULL consistently with
constant-folded evaluation.
- Does this need documentation?
- [x] No.
### Check List (For Reviewer who merge this PR)
- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label
--
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]