From 4e8d0983132d5000aa0193e9d45d7a586c4cc8b9 Mon Sep 17 00:00:00 2001 From: yanweiqi <592838129@qq.com> Date: Wed, 8 Feb 2023 18:11:38 +0800 Subject: [PATCH] least/greatest function for string (#6662) close pingcap/tiflash#6660 --- dbms/src/Functions/LeastGreatest.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dbms/src/Functions/LeastGreatest.h b/dbms/src/Functions/LeastGreatest.h index 426857e09e4..d9bf90fc691 100644 --- a/dbms/src/Functions/LeastGreatest.h +++ b/dbms/src/Functions/LeastGreatest.h @@ -507,9 +507,28 @@ class FunctionLeastGreatestString : public IFunction // 2. calculate result column for string columns auto string_columns_size = string_columns.size(); +<<<<<<< HEAD ColumnString * result_col = nullptr; if (string_columns_size == 1) result_col = const_cast(string_columns[0]); +======= + if (string_columns_size == 1) + { + // 3A. merge result columns of const columns and result_col + ColumnString * result_col = nullptr; + result_col = const_cast(string_columns[0]); + auto col_str = ColumnString::create(); + impl::stringVectorConstant( + collator, + result_col->getChars(), + result_col->getOffsets(), + const_res, + col_str->getChars(), + col_str->getOffsets()); + block.getByPosition(result).column = std::move(col_str); + return; + } +>>>>>>> f14785927 (least/greatest function for string (#6662)) else if (string_columns_size >= 2) { std::vector result_string_refs; @@ -550,7 +569,11 @@ class FunctionLeastGreatestString : public IFunction } else { +<<<<<<< HEAD // 3A. merge result columns of const columns and vector columns +======= + // 3B. merge result columns of const columns and vector columns +>>>>>>> f14785927 (least/greatest function for string (#6662)) auto col_str = ColumnString::create(); impl::stringRefVectorConstant( collator,