Remove questionable code

This commit is contained in:
Alexey Milovidov 2020-09-17 17:38:06 +03:00
parent 5539c6ecaa
commit c1e9ce2cf2
5 changed files with 6 additions and 17 deletions

View File

@ -189,13 +189,11 @@ Names extractPrimaryKeyColumnNames(const ASTPtr & storage_ast)
ErrorCodes::BAD_ARGUMENTS); ErrorCodes::BAD_ARGUMENTS);
Names primary_key_columns; Names primary_key_columns;
Names sorting_key_columns;
NameSet primary_key_columns_set; NameSet primary_key_columns_set;
for (size_t i = 0; i < sorting_key_size; ++i) for (size_t i = 0; i < sorting_key_size; ++i)
{ {
String sorting_key_column = sorting_key_expr_list->children[i]->getColumnName(); String sorting_key_column = sorting_key_expr_list->children[i]->getColumnName();
sorting_key_columns.push_back(sorting_key_column);
if (i < primary_key_size) if (i < primary_key_size)
{ {

View File

@ -6,6 +6,9 @@
#include <Core/Defines.h> #include <Core/Defines.h>
#include <ext/map.h>
#include <boost/algorithm/string/join.hpp>
namespace DB namespace DB
{ {
@ -268,7 +271,7 @@ inline TaskTable::TaskTable(TaskCluster & parent, const Poco::Util::AbstractConf
ParserStorage parser_storage; ParserStorage parser_storage;
engine_push_ast = parseQuery(parser_storage, engine_push_str, 0, DBMS_DEFAULT_MAX_PARSER_DEPTH); engine_push_ast = parseQuery(parser_storage, engine_push_str, 0, DBMS_DEFAULT_MAX_PARSER_DEPTH);
engine_push_partition_key_ast = extractPartitionKey(engine_push_ast); engine_push_partition_key_ast = extractPartitionKey(engine_push_ast);
primary_key_comma_separated = Nested::createCommaSeparatedStringFrom(extractPrimaryKeyColumnNames(engine_push_ast)); primary_key_comma_separated = boost::algorithm::join(ext::map(extractPrimaryKeyColumnNames(engine_push_ast), backQuote), ", ");
engine_push_zk_path = extractReplicatedTableZookeeperPath(engine_push_ast); engine_push_zk_path = extractReplicatedTableZookeeperPath(engine_push_ast);
} }

View File

@ -70,17 +70,6 @@ std::pair<std::string, std::string> splitName(const std::string & name)
return {{ begin, first_end }, { second_begin, end }}; return {{ begin, first_end }, { second_begin, end }};
} }
std::string createCommaSeparatedStringFrom(const Names & names)
{
std::ostringstream ss;
if (!names.empty())
{
std::copy(names.begin(), std::prev(names.end()), std::ostream_iterator<std::string>(ss, ", "));
ss << names.back();
}
return ss.str();
}
std::string extractTableName(const std::string & nested_name) std::string extractTableName(const std::string & nested_name)
{ {

View File

@ -13,8 +13,6 @@ namespace Nested
std::pair<std::string, std::string> splitName(const std::string & name); std::pair<std::string, std::string> splitName(const std::string & name);
std::string createCommaSeparatedStringFrom(const Names & names);
/// Returns the prefix of the name to the first '.'. Or the name is unchanged if there is no dot. /// Returns the prefix of the name to the first '.'. Or the name is unchanged if there is no dot.
std::string extractTableName(const std::string & nested_name); std::string extractTableName(const std::string & nested_name);

View File

@ -49,6 +49,7 @@
#include <Poco/DirectoryIterator.h> #include <Poco/DirectoryIterator.h>
#include <boost/range/adaptor/filtered.hpp> #include <boost/range/adaptor/filtered.hpp>
#include <boost/algorithm/string/join.hpp>
#include <algorithm> #include <algorithm>
#include <iomanip> #include <iomanip>
@ -632,7 +633,7 @@ void MergeTreeData::MergingParams::check(const StorageInMemoryMetadata & metadat
std::back_inserter(names_intersection)); std::back_inserter(names_intersection));
if (!names_intersection.empty()) if (!names_intersection.empty())
throw Exception("Columns: " + Nested::createCommaSeparatedStringFrom(names_intersection) + throw Exception("Columns: " + boost::algorithm::join(names_intersection, ", ") +
" listed both in columns to sum and in partition key. That is not allowed.", ErrorCodes::BAD_ARGUMENTS); " listed both in columns to sum and in partition key. That is not allowed.", ErrorCodes::BAD_ARGUMENTS);
} }
} }