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

zclll 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 c5258670ffb [fix](substring) Fix `substring_index` (#60346)
c5258670ffb is described below

commit c5258670ffb58d0a6e98ef778235d275d7d2ea0b
Author: Gabriel <[email protected]>
AuthorDate: Thu Jan 29 22:29:42 2026 +0800

    [fix](substring) Fix `substring_index` (#60346)
    
    *** Query id: c1ff38c3dec047ae-bfce7919ca736eda ***
    *** is nereids: 1 ***
    *** tablet id: 0 ***
    *** Aborted at 1768984432 (unix time) try "date -d @1768984432" if you
    are using GNU date ***
    *** Current BE git commitID: 22974f924b9 ***
    *** SIGSEGV invalid permissions for mapped object (@0x7fa6ea546000)
    received by PID 4132275 (TID 4134631 OR 0x7f9e21ed7700) from PID
    18446744073345982464; stack trace: ***
    0# doris::signal::(anonymous namespace)::FailureSignalHandler(int,
    siginfo_t*, void*) at
    /root/selectdb-core/be/src/common/signal_handler.h:421
    1# PosixSignals::chained_handler(int, siginfo*, void*) [clone .part.0]
    in /opt/jdk/lib/server/[libjvm.so](http://libjvm.so/)
    2# JVM_handle_linux_signal in
    /opt/jdk/lib/server/[libjvm.so](http://libjvm.so/)
     3# 0x00007FAA529DFB50 in /lib64/libc.so.6
     4# __memchr_avx2 in /lib64/libc.so.6
    5#
    
doris::vectorized::FunctionSubstringIndex::execute_impl(doris::FunctionContext*,
    doris::vectorized::Block&, std::vector<unsigned long,
    std::allocator<unsigned long> > const&,
    unsigned long, unsigned long) const at
    /root/selectdb-core/be/src/vec/functions/function_string.h:2066
---
 be/src/vec/functions/function_string.h             |  2 +-
 .../data/function_p0/test_substring_index.out      |  4 ++++
 .../suites/function_p0/test_substring_index.groovy | 22 ++++++++++++++++++++++
 3 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/functions/function_string.h 
b/be/src/vec/functions/function_string.h
index 68922542206..943bf740c8e 100644
--- a/be/src/vec/functions/function_string.h
+++ b/be/src/vec/functions/function_string.h
@@ -1905,7 +1905,7 @@ public:
         }
 
         for (size_t i = 0; i < input_rows_count; ++i) {
-            auto str = str_col->get_data_at(i);
+            auto str = str_col->get_data_at(content_const ? 0 : i);
             auto delimiter = delimiter_col->get_data_at(delimiter_const ? 0 : 
i);
             int32_t delimiter_size = delimiter.size;
 
diff --git a/regression-test/data/function_p0/test_substring_index.out 
b/regression-test/data/function_p0/test_substring_index.out
index 480f2c2b482..aabc01e39c4 100644
--- a/regression-test/data/function_p0/test_substring_index.out
+++ b/regression-test/data/function_p0/test_substring_index.out
@@ -46,3 +46,7 @@
 -- !sql --
                                test|test       test|test
 
+-- !sql --
+
+
+
diff --git a/regression-test/suites/function_p0/test_substring_index.groovy 
b/regression-test/suites/function_p0/test_substring_index.groovy
index 47df1208a00..cd094c396af 100644
--- a/regression-test/suites/function_p0/test_substring_index.groovy
+++ b/regression-test/suites/function_p0/test_substring_index.groovy
@@ -134,4 +134,26 @@ suite("test_substring_index") {
     """
 
     sql "DROP TABLE IF EXISTS test_substring_index"
+
+    sql "DROP TABLE IF EXISTS test_substring_index2"
+    sql """
+    CREATE TABLE test_substring_index2 (
+        id INT,
+        str VARCHAR(100),
+        delimiter VARCHAR(10)
+    ) ENGINE=OLAP
+    DUPLICATE KEY(id)
+    DISTRIBUTED BY HASH(id) BUCKETS 1
+    PROPERTIES (
+        "replication_allocation" = "tag.location.default: 1"
+    )
+    """
+
+    sql """
+    INSERT INTO test_substring_index2 VALUES
+        (1, NULL, NULL),
+        (2, NULL, NULL)
+    """
+    qt_sql """ SELECT  SUBSTRING_INDEX(IFNULL(a.str, ''), ',', a.id) from 
test_substring_index2 a """
+    sql "DROP TABLE IF EXISTS test_substring_index2"
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to