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

Mryange 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 434ab773311 [fix](function) Fix MAKE_SET constant NULL handling 
(#68274)
434ab773311 is described below

commit 434ab773311aefeab5497283226f242b30cbc70a
Author: Mryange <[email protected]>
AuthorDate: Mon Sep 21 18:00:48 2026 +0800

    [fix](function) Fix MAKE_SET constant NULL handling (#68274)
    
    `MAKE_SET` returned NULL for every row when its first string argument
    was a constant NULL and the bits argument was a column. With
    non-nullable bits, this also produced an internal return-type mismatch
    because the function emitted `Nullable(String)` while declaring
    `String`. Root cause: the constant-NULL fast path treated argument index
    1, the first string argument, as the bits argument. This change applies
    NULL propagation only to argument index 0 and lets the normal row path
    skip NULL string arguments as documented.
    Problem Summary:
    
    ### Release note
    
    None
    
    ### Check List (For Author)
    
    - Test <!-- At least one of them must be included. -->
        - [ ] Regression test
        - [ ] Unit Test
        - [ ] Manual test (add detailed scripts or steps below)
        - [ ] No need to test or manual test. Explain why:
    - [ ] This is a refactor/code format and no logic has been changed.
            - [ ] Previous test can cover this change.
            - [ ] No code files have been changed.
            - [ ] Other reason <!-- Add your reason?  -->
    
    - Behavior changed:
        - [ ] No.
        - [ ] Yes. <!-- Explain the behavior change -->
    
    - Does this need documentation?
        - [ ] No.
    - [ ] Yes. <!-- Add document PR link here. eg:
    https://github.com/apache/doris-website/pull/1214 -->
    
    ### Check List (For Reviewer who merge this PR)
    
    - [ ] Confirm the release note
    - [ ] Confirm test cases
    - [ ] Confirm document
    - [ ] Add branch pick label <!-- Add branch pick label that this PR
    should merge into -->
---
 be/src/exprs/function/function_string_misc.cpp  |  3 ++-
 be/test/exprs/function/function_string_test.cpp | 27 +++++++++++++++++++++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/be/src/exprs/function/function_string_misc.cpp 
b/be/src/exprs/function/function_string_misc.cpp
index 663fa0fe018..86918be9556 100644
--- a/be/src/exprs/function/function_string_misc.cpp
+++ b/be/src/exprs/function/function_string_misc.cpp
@@ -1274,7 +1274,8 @@ public:
     static bool execute_const_null(ColumnString::MutablePtr& res_col,
                                    PaddedPODArray<UInt8>& res_null_map_data,
                                    size_t input_rows_count, size_t null_index) 
{
-        if (null_index == 1) {
+        // Only a NULL bits argument makes the result NULL; NULL strings are 
skipped.
+        if (null_index == 0) {
             res_col->insert_many_defaults(input_rows_count);
             res_null_map_data.assign(input_rows_count, (UInt8)1);
             return true;
diff --git a/be/test/exprs/function/function_string_test.cpp 
b/be/test/exprs/function/function_string_test.cpp
index b908d95ee95..3a8debab7ad 100644
--- a/be/test/exprs/function/function_string_test.cpp
+++ b/be/test/exprs/function/function_string_test.cpp
@@ -132,6 +132,33 @@ TEST(function_string_test, 
function_auto_partition_name_case_insensitive_test) {
     }
 }
 
+TEST(function_string_test, function_make_set_const_null_string_test) {
+    const InputTypeSet not_null_bits_types = {Notnull 
{PrimitiveType::TYPE_BIGINT},
+                                              Consted 
{PrimitiveType::TYPE_STRING},
+                                              PrimitiveType::TYPE_STRING};
+    const DataSet not_null_bits_data = {
+            {{BIGINT(2), Null(), std::string("B")}, std::string("B")},
+            {{BIGINT(3), Null(), std::string("C")}, std::string("C")},
+            {{BIGINT(0), Null(), std::string("D")}, std::string("")},
+    };
+    for (const auto& data : not_null_bits_data) {
+        ASSERT_TRUE(check_function<DataTypeString>("make_set", 
not_null_bits_types, {data}).ok());
+    }
+
+    const InputTypeSet nullable_bits_types = {Nullable 
{PrimitiveType::TYPE_BIGINT},
+                                              Consted 
{PrimitiveType::TYPE_STRING},
+                                              PrimitiveType::TYPE_STRING};
+    const DataSet nullable_bits_data = {
+            {{BIGINT(2), Null(), std::string("B")}, std::string("B")},
+            {{Null(), Null(), std::string("C")}, Null()},
+            {{BIGINT(0), Null(), std::string("D")}, std::string("")},
+    };
+    for (const auto& data : nullable_bits_data) {
+        ASSERT_TRUE((check_function<DataTypeString, true>("make_set", 
nullable_bits_types, {data})
+                             .ok()));
+    }
+}
+
 TEST(function_string_test, function_string_substr_test) {
     std::string func_name = "substr";
 


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

Reply via email to