This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-4.1 by this push:
new 6aae9865467 branch-4.1: [fix](function) Handle constant NULL arrays in
array pushback #68380 (#68442)
6aae9865467 is described below
commit 6aae9865467170ad2d6c94d6138885993052c04a
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Sep 24 14:15:35 2026 +0800
branch-4.1: [fix](function) Handle constant NULL arrays in array pushback
#68380 (#68442)
Cherry-picked from #68380
Co-authored-by: Mryange <[email protected]>
---
.../function/array/function_array_pushback.cpp | 7 +++--
.../test_array_functions_by_literal.out | 36 ++++++++++++++++++++++
.../test_array_functions_by_literal.groovy | 2 ++
3 files changed, 42 insertions(+), 3 deletions(-)
diff --git a/be/src/exprs/function/array/function_array_pushback.cpp
b/be/src/exprs/function/array/function_array_pushback.cpp
index 53e6983d373..94880396e7c 100644
--- a/be/src/exprs/function/array/function_array_pushback.cpp
+++ b/be/src/exprs/function/array/function_array_pushback.cpp
@@ -94,14 +94,15 @@ public:
size_t off = 0;
for (size_t i = 0; i < input_rows_count; ++i) {
- if (array_null_map && array_null_map[i]) {
+ const size_t src_index = index_check_const(i, src_const);
+ if (array_null_map && array_null_map[src_index]) {
result_null_map[i] = 1;
result_offset_col[i] = off;
continue;
}
- size_t src_off = src_offset_col[index_check_const(i, src_const) -
1];
- size_t src_len = src_offset_col[index_check_const(i, src_const)] -
src_off;
+ size_t src_off = src_offset_col[src_index - 1];
+ size_t src_len = src_offset_col[src_index] - src_off;
result_nested_data_col.insert_range_from(src_nested_data_col,
src_off, src_len);
result_nested_data_col.insert((*right_column)[index_check_const(i,
right_const)]);
diff --git
a/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_by_literal.out
b/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_by_literal.out
index 5ebef1618f9..9fe328a301f 100644
---
a/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_by_literal.out
+++
b/regression-test/data/query_p0/sql_functions/array_functions/test_array_functions_by_literal.out
@@ -932,6 +932,42 @@ _
-- !sql --
[null, null, null, null, 80]
+-- !sql --
+0 \N
+1 \N
+2 \N
+3 \N
+4 \N
+5 \N
+6 \N
+7 \N
+8 \N
+9 \N
+10 \N
+11 \N
+12 \N
+13 \N
+14 \N
+15 \N
+
+-- !sql --
+0 \N
+1 \N
+2 \N
+3 \N
+4 \N
+5 \N
+6 \N
+7 \N
+8 \N
+9 \N
+10 \N
+11 \N
+12 \N
+13 \N
+14 \N
+15 \N
+
-- !sql --
[0, 2, 129]
diff --git
a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_by_literal.groovy
b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_by_literal.groovy
index b51a0b6bd6b..600c6e3db93 100644
---
a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_by_literal.groovy
+++
b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_functions_by_literal.groovy
@@ -386,6 +386,8 @@ suite("test_array_functions_by_literal") {
qt_sql "select array_pushback(array(cast (111.111 as
decimalv3(6,3)),cast (222.222 as decimalv3(6,3))), cast (333.333 as
decimalv3(6,3)))"
qt_sql "select array_pushback([null,null], null)"
qt_sql "select array_pushback([null,null,null,null], 80)"
+ qt_sql "select number, array_pushback(cast(null as array<int>),
number) from numbers('number'='16') order by number"
+ qt_sql "select number, array_append(cast(null as array<int>), number)
from numbers('number'='16') order by number"
// array_cum_sum
qt_sql "select array_cum_sum([0, 2, 127])"
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]