[BugFix] Fix array_map expr get wrong result from constant unary expr (backport #66514)
Why I'm doing:
see reproduce case
What I'm doing:
Fixes #issue
What type of PR is this:
- [x] BugFix
- [ ] Feature
- [ ] Enhancement
- [ ] Refactor
- [ ] UT
- [ ] Doc
- [ ] Tool
Does this PR entail a change in behavior?
- [ ] Yes, this PR will result in a change in behavior.
- [x] No, this PR will not result in a change in behavior.
If yes, please specify the type of change:
- [ ] Interface/UI changes: syntax, type conversion, expression evaluation, display information
- [ ] Parameter changes: default values, similar parameters but with different default values
- [ ] Policy changes: use new policy to replace old one, functionality automatically enabled
- [ ] Feature removed
- [ ] Miscellaneous: upgrade & downgrade compatibility, etc.
Checklist:
- [x] I have added test cases for my bug fix or my new feature
- [ ] This pr needs user documentation (for new or modified features or behaviors)
- [ ] I have added documentation for my new feature or new function
- [x] This is a backport pr
Bugfix cherry-pick branch check:
- [x] I have checked the version labels which the pr will be auto-backported to the target branch
- [x] 4.0
- [x] 3.5
- [x] 3.4
- [x] 3.3
[!NOTE] Fix array_map evaluation for independent lambdas with constant input, initialize Java UDF random-value flag, and add SQL tests validating UDF usage with any_match.
- Exprs:
- array_map: When evaluating independent lambdas without input columns, ensure the lambda result is treated as a single-row const (or const-null) column before replication; aligns return types and prevents incorrect results from constant unary expressions (
be/src/exprs/array_map_expr.cpp).- Java UDF: Initialize
_is_returning_random_valuetofalseto avoid uninitialized state (be/src/exprs/java_function_call_expr.h).- Tests:
- Add UDF
echoint, tablet1, data load viagenerate_series, and query usingany_match((x)->cast(echoint(1) as boolean), c2)with expected count40960(test/sql/test_udf/T|R/test_jvm_udf).Written by Cursor Bugbot for commit 0a51ce5fb594e1d64350baf23396d24ec81df8be. This will update automatically on new commits. Configure here.
This is an automatic backport of pull request #66514 done by [Mergify](https://mergify.com).
[!NOTE] Fix array_map for independent lambdas with constant input by forcing a single-row const result before replication; initialize Java UDF random-value flag; add SQL tests using echoint with any_match.
- Exprs:
- array_map (
be/src/exprs/array_map_expr.cpp): For independent lambdas with no input columns, treat evaluated result as a 1-row const (or const-null) column before replication; enforce size check and align return type.- Java UDF (
be/src/exprs/java_function_call_expr.h): Initialize_is_returning_random_valuetofalse.- Tests (
test/sql/test_udf/T|R/test_jvm_udf):
- Add UDF
echoint, create tablet1, load data viagenerate_series, and validateany_match((x)->cast(echoint(1) as boolean), c2)returns40960.Written by Cursor Bugbot for commit 0bf1c2ba57414dd6f0b66705bd46a646c8795ba1. This will update automatically on new commits. Configure here.
๐งช CI Insights
Here's what we observed from your CI run for 0bf1c2ba.
โ Passed Jobs With Interesting Signals
| Pipeline | Job | Signal | Health on branch-3.5 |
Retries | ๐ CI Insights | ๐ Logs |
|---|---|---|---|---|---|---|
PR CHECKER |
automerge-check |
Base branch is broken, but the job passed. Looks like this might be a real fix ๐ช | 0 |
View | View |
@cursor review