You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by xu...@apache.org on 2022/10/27 15:11:20 UTC

[doris] branch master updated: [fix](array-type) fix the be core dump when select the invalid array format (#13514)

This is an automated email from the ASF dual-hosted git repository.

xuyang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 36053d2419 [fix](array-type) fix the be core dump when select the invalid array format (#13514)
36053d2419 is described below

commit 36053d2419089a5977ce0353c8c5010ed0b56e8a
Author: carlvinhust2012 <hu...@126.com>
AuthorDate: Thu Oct 27 23:11:12 2022 +0800

    [fix](array-type) fix the be core dump when select the invalid array format (#13514)
    
    1. this pr is used to fix the be core dump when select the invalid array.
    2. before the change, we run "select array_intersect([1, 2, 3, 1, 2, 3], '1[3, 2, 5]');" will cause be core dump.
    MySQL [example_db]> select array_intersect([1, 2, 3, 1, 2, 3], '1[3, 2, 5]');
    ERROR 1105 (HY000): RpcException, msg: io.grpc.StatusRuntimeException: UNAVAILABLE: Network closed for unknown reason
    3. after the change, we run "select array_intersect([1, 2, 3, 1, 2, 3], '1[3, 2, 5]');" will get error message.
    MySQL [example_db]> select array_intersect([1, 2, 3, 1, 2, 3], '1[3, 2, 5]');
    errCode = 2, detailMessage = No matching function with signature: array_intersect(array<tinyint(4)>, varchar(-1))"
    Co-authored-by: hucheng01 <hu...@baidu.com>
---
 be/src/vec/exprs/vexpr.cpp                                          | 4 +++-
 .../array_functions/test_array_functions_by_literal.groovy          | 6 ++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/exprs/vexpr.cpp b/be/src/vec/exprs/vexpr.cpp
index 0fe5d9296f..551b128b30 100644
--- a/be/src/vec/exprs/vexpr.cpp
+++ b/be/src/vec/exprs/vexpr.cpp
@@ -322,7 +322,9 @@ ColumnPtrWrapper* VExpr::get_const_col(VExprContext* context) {
     // If block is empty, some functions will produce no result. So we insert a column with
     // single value here.
     block.insert({ColumnUInt8::create(1), std::make_shared<DataTypeUInt8>(), ""});
-    execute(context, &block, &result);
+    if (!execute(context, &block, &result).ok()) {
+        return nullptr;
+    }
     DCHECK(result != -1);
     const auto& column = block.get_by_position(result).column;
     _constant_col = std::make_shared<ColumnPtrWrapper>(column);
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 ab5cd580aa..ca7041cc2c 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
@@ -162,4 +162,10 @@ suite("test_array_functions_by_literal") {
     qt_sql "select array_join([null, null, 1, 2, '', '', null], '_', 'any')"
     qt_sql "select array_join([''], '_')"
     qt_sql "select array_join(['', ''], '_')"
+
+    // abnormal test
+    test {
+        sql "select array_intersect([1, 2, 3, 1, 2, 3], '1[3, 2, 5]')"
+        exception "errCode = 2, detailMessage = No matching function with signature: array_intersect(array<tinyint(4)>, varchar(-1))"
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org