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

morningman pushed a commit to branch branch-hive-test
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-hive-test by this push:
     new a25eeb8eb0 Revert and cherry-pick "[Refactor](function) opt the exec 
of function with null column". (#16852)
a25eeb8eb0 is described below

commit a25eeb8eb07a9a73dca6b4c1efb7f0a825cd4669
Author: Qi Chen <kaka11.c...@gmail.com>
AuthorDate: Fri Feb 17 10:08:04 2023 +0800

    Revert and cherry-pick "[Refactor](function) opt the exec of function with 
null column". (#16852)
---
 be/src/vec/functions/function_cast.h      |  7 ++++---
 be/src/vec/functions/function_helpers.cpp | 13 +++++++++++--
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/be/src/vec/functions/function_cast.h 
b/be/src/vec/functions/function_cast.h
index 62b716d1a9..a6817134ea 100644
--- a/be/src/vec/functions/function_cast.h
+++ b/be/src/vec/functions/function_cast.h
@@ -1592,10 +1592,11 @@ private:
                 Block tmp_block;
                 size_t tmp_res_index = 0;
                 if (source_is_nullable) {
-                    auto [t_block, tmp_args, tmp_res] =
-                            create_block_with_nested_columns(block, arguments, 
result);
+                    auto [t_block, tmp_args] =
+                            create_block_with_nested_columns(block, arguments, 
true);
                     tmp_block = std::move(t_block);
-                    tmp_res_index = tmp_res;
+                    tmp_res_index = tmp_block.columns();
+                    tmp_block.insert({nullptr, nested_type, ""});
 
                     /// Perform the requested conversion.
                     RETURN_IF_ERROR(
diff --git a/be/src/vec/functions/function_helpers.cpp 
b/be/src/vec/functions/function_helpers.cpp
index 560f54e1a5..c77f3c5ab7 100644
--- a/be/src/vec/functions/function_helpers.cpp
+++ b/be/src/vec/functions/function_helpers.cpp
@@ -20,6 +20,7 @@
 
 #include "vec/functions/function_helpers.h"
 
+#include "common/consts.h"
 #include "vec/columns/column_nullable.h"
 #include "vec/data_types/data_type_nullable.h"
 #include "vec/functions/function.h"
@@ -42,14 +43,14 @@ std::tuple<Block, ColumnNumbers> 
create_block_with_nested_columns(const Block& b
             for (int j = 0; j < i; ++j) {
                 if (args[j] == args[i]) {
                     is_in_res = true;
-                    pre_loc = j;
+                    pre_loc = res_args[j];
                     break;
                 }
             }
         }
 
         if (!is_in_res) {
-            const auto& col = block.get_by_position(i);
+            const auto& col = block.get_by_position(args[i]);
             if (col.type->is_nullable()) {
                 const DataTypePtr& nested_type =
                         static_cast<const 
DataTypeNullable&>(*col.type).get_nested_type();
@@ -78,6 +79,14 @@ std::tuple<Block, ColumnNumbers> 
create_block_with_nested_columns(const Block& b
         }
     }
 
+    // TODO: only support match function, rethink the logic
+    for (const auto& ctn : block) {
+        if (ctn.name.size() > BeConsts::BLOCK_TEMP_COLUMN_PREFIX.size() &&
+            starts_with(ctn.name, BeConsts::BLOCK_TEMP_COLUMN_PREFIX)) {
+            res.insert(ctn);
+        }
+    }
+
     return {res, res_args};
 }
 


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

Reply via email to