From d6480b846c070cd5953dc4839142756de472551f Mon Sep 17 00:00:00 2001 From: Yarik Briukhovetskyi <114298166+yariks5s@users.noreply.github.com> Date: Tue, 3 Dec 2024 20:30:06 +0100 Subject: [PATCH] Fix run issues --- src/AggregateFunctions/AggregateFunctionGroupConcat.h | 7 +++---- src/Analyzer/QueryTreeBuilder.cpp | 9 ++++----- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/AggregateFunctions/AggregateFunctionGroupConcat.h b/src/AggregateFunctions/AggregateFunctionGroupConcat.h index 3e5f824f8f5..585dec8e90f 100644 --- a/src/AggregateFunctions/AggregateFunctionGroupConcat.h +++ b/src/AggregateFunctions/AggregateFunctionGroupConcat.h @@ -49,8 +49,6 @@ class GroupConcatImpl : public IAggregateFunctionDataHelper names_and_aliases = { "groupConcat", "group_concat" }; - SerializationPtr serialization; UInt64 limit; const String delimiter; @@ -61,9 +59,10 @@ public: String getName() const override; - static std::array getNameAndAliases() + static const std::vector& getNameAndAliases() { - return names_and_aliases; + static const std::vector aliases = {"groupConcat", "group_concat"}; + return aliases; } void add(AggregateDataPtr place, const IColumn ** columns, size_t row_num, Arena * arena) const override; diff --git a/src/Analyzer/QueryTreeBuilder.cpp b/src/Analyzer/QueryTreeBuilder.cpp index 6a761befe2b..3f4ef587cbc 100644 --- a/src/Analyzer/QueryTreeBuilder.cpp +++ b/src/Analyzer/QueryTreeBuilder.cpp @@ -648,11 +648,10 @@ QueryTreeNodePtr QueryTreeBuilder::buildExpression(const ASTPtr & expression, co } else { - const char * name = function->name.c_str(); - // Check if the function is groupConcat with exactly two arguments - if (std::any_of(GroupConcatImpl::getNameAndAliases().begin(), - GroupConcatImpl::getNameAndAliases().end(), - [name](const char *alias) { return std::strcmp(name, alias) == 0; }) + const auto & group_concat_aliases = GroupConcatImpl::getNameAndAliases(); + if (!function->name.empty() && std::any_of( + group_concat_aliases.begin(), group_concat_aliases.end(), + [&](const std::string &s) { return s == function->name; }) && function->arguments && function->arguments->children.size() == 2) { result = setFirstArgumentAsParameter(function, context);