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

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


The following commit(s) were added to refs/heads/master by this push:
     new 56adc7f  [Bug][vec] Fix bug of nullable const value convert to 
argument cause coredump (#8139)
56adc7f is described below

commit 56adc7f56bb450fe9b766355cfb473223a2fba8f
Author: HappenLee <[email protected]>
AuthorDate: Sun Feb 20 20:05:23 2022 +0800

    [Bug][vec] Fix bug of nullable const value convert to argument cause 
coredump (#8139)
    
    Co-authored-by: lihaopeng <[email protected]>
---
 be/src/vec/functions/function_conv.cpp     |  5 ++++-
 be/src/vec/functions/function_convert_tz.h |  5 ++++-
 be/src/vec/functions/function_string.h     | 22 ++++++++++++++++++----
 be/src/vec/functions/function_totype.h     | 10 ++++++++--
 4 files changed, 34 insertions(+), 8 deletions(-)

diff --git a/be/src/vec/functions/function_conv.cpp 
b/be/src/vec/functions/function_conv.cpp
index ae88f68..1385603 100644
--- a/be/src/vec/functions/function_conv.cpp
+++ b/be/src/vec/functions/function_conv.cpp
@@ -54,9 +54,12 @@ public:
         for (int i = 0; i < 3; ++i) {
             argument_columns[i] = 
block.get_by_position(arguments[i]).column->convert_to_full_column_if_const();
             if (auto* nullable = 
check_and_get_column<ColumnNullable>(*argument_columns[i])) {
-                argument_columns[i] = nullable->get_nested_column_ptr();
+                // Danger: Here must dispose the null map data first! Because
+                // argument_columns[i]=nullable->get_nested_column_ptr(); will 
release the mem
+                // of column nullable mem of null map
                 
VectorizedUtils::update_null_map(result_null_map_column->get_data(),
                                                  
nullable->get_null_map_data());
+                argument_columns[i] = nullable->get_nested_column_ptr();
             }
         }
 
diff --git a/be/src/vec/functions/function_convert_tz.h 
b/be/src/vec/functions/function_convert_tz.h
index 739279d..6666729 100644
--- a/be/src/vec/functions/function_convert_tz.h
+++ b/be/src/vec/functions/function_convert_tz.h
@@ -54,9 +54,12 @@ public:
             argument_columns[i] =
                     
block.get_by_position(arguments[i]).column->convert_to_full_column_if_const();
             if (auto* nullable = 
check_and_get_column<ColumnNullable>(*argument_columns[i])) {
-                argument_columns[i] = nullable->get_nested_column_ptr();
+                // Danger: Here must dispose the null map data first! Because
+                // argument_columns[i]=nullable->get_nested_column_ptr(); will 
release the mem
+                // of column nullable mem of null map
                 
VectorizedUtils::update_null_map(result_null_map_column->get_data(),
                                                  
nullable->get_null_map_data());
+                argument_columns[i] = nullable->get_nested_column_ptr();
             }
         }
 
diff --git a/be/src/vec/functions/function_string.h 
b/be/src/vec/functions/function_string.h
index 934053e..c14e639 100644
--- a/be/src/vec/functions/function_string.h
+++ b/be/src/vec/functions/function_string.h
@@ -127,9 +127,12 @@ struct SubstringUtil {
             argument_columns[i] =
                     
block.get_by_position(arguments[i]).column->convert_to_full_column_if_const();
             if (auto* nullable = 
check_and_get_column<ColumnNullable>(*argument_columns[i])) {
-                argument_columns[i] = nullable->get_nested_column_ptr();
+                // Danger: Here must dispose the null map data first! Because
+                // argument_columns[i]=nullable->get_nested_column_ptr(); will 
release the mem
+                // of column nullable mem of null map
                 VectorizedUtils::update_null_map(null_map->get_data(),
                                                  
nullable->get_null_map_data());
+                argument_columns[i] = nullable->get_nested_column_ptr();
             }
         }
 
@@ -521,13 +524,18 @@ public:
         std::vector<const ColumnUInt8::Container*> null_list(argument_size);
 
         ColumnPtr argument_columns[argument_size];
+        ColumnPtr argument_null_columns[argument_size];
 
         for (size_t i = 0; i < argument_size; ++i) {
             argument_columns[i] =
                     
block.get_by_position(arguments[i]).column->convert_to_full_column_if_const();
             if (auto* nullable = check_and_get_column<const 
ColumnNullable>(*argument_columns[i])) {
-                argument_columns[i] = nullable->get_nested_column_ptr();
+                // Danger: Here must dispose the null map data first! Because
+                // argument_columns[i]=nullable->get_nested_column_ptr(); will 
release the mem
+                // of column nullable mem of null map
                 null_list[i] = &nullable->get_null_map_data();
+                argument_null_columns[i] = nullable->get_null_map_column_ptr();
+                argument_columns[i] = nullable->get_nested_column_ptr();
             } else {
                 null_list[i] = &const_null_map->get_data();
             }
@@ -670,9 +678,12 @@ public:
             argument_columns[i] =
                     
block.get_by_position(arguments[i]).column->convert_to_full_column_if_const();
             if (auto* nullable = check_and_get_column<const 
ColumnNullable>(*argument_columns[i])) {
-                argument_columns[i] = nullable->get_nested_column_ptr();
+                // Danger: Here must dispose the null map data first! Because
+                // argument_columns[i]=nullable->get_nested_column_ptr(); will 
release the mem
+                // of column nullable mem of null map
                 VectorizedUtils::update_null_map(null_map->get_data(),
                                                  
nullable->get_null_map_data());
+                argument_columns[i] = nullable->get_nested_column_ptr();
             }
         }
 
@@ -817,9 +828,12 @@ public:
             argument_columns[i] =
                     
block.get_by_position(arguments[i]).column->convert_to_full_column_if_const();
             if (auto* nullable = check_and_get_column<const 
ColumnNullable>(*argument_columns[i])) {
-                argument_columns[i] = nullable->get_nested_column_ptr();
+                // Danger: Here must dispose the null map data first! Because
+                // argument_columns[i]=nullable->get_nested_column_ptr(); will 
release the mem
+                // of column nullable mem of null map
                 VectorizedUtils::update_null_map(null_map->get_data(),
                                                  
nullable->get_null_map_data());
+                argument_columns[i] = nullable->get_nested_column_ptr();
             }
         }
 
diff --git a/be/src/vec/functions/function_totype.h 
b/be/src/vec/functions/function_totype.h
index fef300e..425a09b 100644
--- a/be/src/vec/functions/function_totype.h
+++ b/be/src/vec/functions/function_totype.h
@@ -291,9 +291,12 @@ public:
             argument_columns[i] =
                     
block.get_by_position(arguments[i]).column->convert_to_full_column_if_const();
             if (auto* nullable = 
check_and_get_column<ColumnNullable>(*argument_columns[i])) {
-                argument_columns[i] = nullable->get_nested_column_ptr();
+                // Danger: Here must dispose the null map data first! Because
+                // argument_columns[i]=nullable->get_nested_column_ptr(); will 
release the mem
+                // of column nullable mem of null map
                 VectorizedUtils::update_null_map(null_map->get_data(),
                                                  
nullable->get_null_map_data());
+                argument_columns[i] = nullable->get_nested_column_ptr();
             }
         }
 
@@ -356,9 +359,12 @@ public:
             argument_columns[i] =
                     
block.get_by_position(arguments[i]).column->convert_to_full_column_if_const();
             if (auto* nullable = 
check_and_get_column<ColumnNullable>(*argument_columns[i])) {
-                argument_columns[i] = nullable->get_nested_column_ptr();
+                // Danger: Here must dispose the null map data first! Because
+                // argument_columns[i]=nullable->get_nested_column_ptr(); will 
release the mem
+                // of column nullable mem of null map
                 VectorizedUtils::update_null_map(null_map->get_data(),
                                                  
nullable->get_null_map_data());
+                argument_columns[i] = nullable->get_nested_column_ptr();
             }
         }
 

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

Reply via email to