morrySnow opened a new pull request, #64847:
URL: https://github.com/apache/doris/pull/64847
### What problem does this PR solve?
Issue Number: close #xxx
Related PR: #xxx
Problem Summary: `array_first` and `array_last` were rewritten through
`array_filter` before their lambda result type was checked against the boolean
filter argument. When the lambda returned a type that can be implicitly cast to
boolean, analysis reported an error instead of applying the normal function
coercion. This change gives `array_first` and `array_last` their own signatures
so the `array_map` result is coerced to `array<boolean>` before the functions
are rewritten to `element_at(array_filter(...))`. It also keeps scalar function
visitor dispatch aligned with the new function shape.
### Release note
Fix `array_first` and `array_last` to allow lambda results that can be
implicitly cast to boolean.
### Check List (For Author)
- Test: Regression test / Unit Test
- `./run-fe-ut.sh --run
org.apache.doris.nereids.trees.expressions.functions.scalar.ArrayFirstLastTest`
- `./run-regression-test.sh --run -d
query_p0/sql_functions/array_functions -s test_array_first,test_array_last`
- Behavior changed: Yes. `array_first` and `array_last` now accept lambda
return values that can be implicitly cast to boolean.
- Does this need documentation: No
--
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]