This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.0 by this push:
new 64892f5d261 branch-4.0: [Fix](func) fix element_at return err when
short-circuit evaluation passes empty input #60570 (#60595)
64892f5d261 is described below
commit 64892f5d26140f92239b7af78545a501929a3afe
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Feb 10 21:22:46 2026 +0800
branch-4.0: [Fix](func) fix element_at return err when short-circuit
evaluation passes empty input #60570 (#60595)
Cherry-picked from #60570
Co-authored-by: linrrarity <[email protected]>
---
.../vec/functions/array/function_array_element.h | 7 -------
.../basic-elements/data-types/map-md.out | 4 ++++
.../basic-elements/data-types/map-md.groovy | 24 +++++++++++++++++++++-
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/be/src/vec/functions/array/function_array_element.h
b/be/src/vec/functions/array/function_array_element.h
index 5f42c2d1e38..de7b90f438b 100644
--- a/be/src/vec/functions/array/function_array_element.h
+++ b/be/src/vec/functions/array/function_array_element.h
@@ -277,13 +277,6 @@ private:
auto val_arr =
ColumnArray::create(map_column.get_values_ptr(),
map_column.get_offsets_ptr());
- const auto& offsets = map_column.get_offsets();
- const size_t rows = offsets.size();
- if (rows <= 0) {
- return nullptr;
- }
- if (key_arr->is_nullable()) {
- }
ColumnPtr matched_indices = _get_mapped_idx(*key_arr, arguments[1]);
if (!matched_indices) {
return nullptr;
diff --git
a/regression-test/data/doc/sql-manual/basic-elements/data-types/map-md.out
b/regression-test/data/doc/sql-manual/basic-elements/data-types/map-md.out
index b78d389f6a3..a9030f76745 100644
--- a/regression-test/data/doc/sql-manual/basic-elements/data-types/map-md.out
+++ b/regression-test/data/doc/sql-manual/basic-elements/data-types/map-md.out
@@ -102,6 +102,10 @@ value1
-- !sql --
20
+-- !element_at_short_circuit_evaluation_test --
+\N
+\N
+
-- !sql --
0
diff --git
a/regression-test/suites/doc/sql-manual/basic-elements/data-types/map-md.groovy
b/regression-test/suites/doc/sql-manual/basic-elements/data-types/map-md.groovy
index 63b8298ef9e..a48f63efa00 100644
---
a/regression-test/suites/doc/sql-manual/basic-elements/data-types/map-md.groovy
+++
b/regression-test/suites/doc/sql-manual/basic-elements/data-types/map-md.groovy
@@ -399,7 +399,29 @@ suite("map-md", "p0") {
qt_sql """ SELECT {'Alice': 20}['Alice']; """
qt_sql """ SELECT ELEMENT_AT({'Alice': 20}, 'Alice');"""
-
+
+ // test whether ELEMENT_AT executes normally in short-circuit-evaluation
+ sql """ DROP TABLE IF EXISTS test_map_sc; """
+ sql """ CREATE TABLE test_map_sc (
+ id INT,
+ join_key DATE,
+ col_map MAP<DATEV2, DATEV2>
+ )PROPERTIES ("replication_num" = "1");
+ """
+ sql """INSERT INTO test_map_sc VALUES
+ (1, '2024-01-01', {'2024-01-01': '2024-01-02'}),
+ (2, '2024-01-02', {'2024-01-01': '2024-01-03'});
+ """
+ sql """ SET short_circuit_evaluation = true; """
+ qt_element_at_short_circuit_evaluation_test """
+ SELECT
+ CASE
+ WHEN id > 0 THEN 1
+ ELSE element_at(col_map, DATE '2024-01-01')
+ END
+ FROM test_map_sc;
+ """
+ sql """ SET short_circuit_evaluation = false; """
qt_sql """ DROP TABLE IF EXISTS ${tableName}; """
sql """
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]