Skip to content

Commit

Permalink
least/greatest function for string (pingcap#6662)
Browse files Browse the repository at this point in the history
  • Loading branch information
ywqzzy committed Feb 13, 2023
1 parent 4386463 commit 4e8d098
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions dbms/src/Functions/LeastGreatest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<ColumnString *>(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<ColumnString *>(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<StringRef> result_string_refs;
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 4e8d098

Please sign in to comment.