mrhhsg opened a new pull request, #71388:
URL: https://github.com/apache/doris/pull/71388
### What problem does this PR solve?
Issue Number: None
Cherry-picked from #68114 (74ae7d20b202afca27dc035f910d5fba6fefdea6).
When constant folding is skipped, a bare NULL container can reach
`element_at` as a null-literal type. Return-type inference previously
interpreted its placeholder type as BOOL and rejected it. Resolve this case to
`Nullable(Nothing)` so `element_at(NULL, ...)` consistently evaluates to NULL.
### Changes
- Recognize a null-literal container before ARRAY/MAP return-type dispatch
and include `DataTypeNothing` directly.
- Reuse the existing NULL execution path and preserve ARRAY/MAP and
STRUCT/FILE handling.
- Adapt unit coverage to the branch-4.1 function-factory API. Include SQL
regression coverage for integer, string and NULL indexes, multiple rows, and
folded/non-folded evaluation.
### Check List (For Author)
- Test:
- Release BE/FE build and packaging (`--be --fe -j 48`), including
Checkstyle: passed.
- Targeted NULL-container GTest linked against Release production
libraries: 1/1 passed. The complete modified BE test translation unit also
passed syntax-only compilation with `BE_TEST`.
- `test_element_at_null_container` SQL regression: 1 suite passed, 0
failed, 0 fatal and 0 skipped. Additional typed ARRAY/MAP/STRUCT queries passed.
- Regression framework compilation, targeted clang-format 16 and `git diff
--check`: passed.
- Full ASAN BE unit suite: not run. Native SQL validation used
`enable_java_support=false`; Java UDF execution was not covered.
- Behavior changed: Yes. A bare NULL container evaluates to NULL when
constant folding is skipped, matching the folded result.
- Does this need documentation: No.
### Release note
Fix `element_at(NULL, ...)` failing when constant folding is skipped.
--
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]