linrrzqqq opened a new pull request, #68022:
URL: https://github.com/apache/doris/pull/68022
### What problem does this PR solve?
Issue Number: None
Related PR: None
Problem Summary:
With short-circuit evaluation disabled, array_map evaluated hidden nested
values belonging to outer-null array or map rows. Invalid hidden values could
therefore raise errors even though the visible result was NULL.
Compact nested lambda inputs for non-null rows and rebuild offsets before
lambda execution, then preserve the original outer null map.
```sql
CREATE TABLE test_array_map_null_filt (
id INT,
a ARRAY<STRING>
)
DUPLICATE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 1
PROPERTIES('replication_num'='1');
INSERT INTO test_array_map_null_filt VALUES
(1, array('bad-number')),
(2, array('10'));
SET enable_strict_cast = true;
SET short_circuit_evaluation = false;
SELECT
id,
array_map(x -> CAST(x AS INT), if(id = 1, CAST(NULL AS ARRAY<STRING>),
a)) AS result_array
FROM test_array_map_null_filt
ORDER BY id;
SELECT
id,
array_map(x -> CAST(x AS INT), if(id = 1, CAST(NULL AS ARRAY<STRING>),
a)) AS result_array
FROM test_array_map_null_filt
ORDER BY id;
-- before:
ERROR 1105 (HY000): Exception, msg: (127.0.0.1)[INVALID_ARGUMENT]parse
number fail, string: 'bad-number'
-- now:
+------+--------------+
| id | result_array |
+------+--------------+
| 1 | NULL |
| 2 | [10] |
+------+--------------+
```
### Release note
Fix lambda functions incorrectly evaluating nested values from NULL array
and map containers.
--
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]