Revert "Replace make_pair()/make_tuple() by pair()/tuple()"

This reverts commit 447a9b3331.
This commit is contained in:
Robert Schulze 2022-05-08 08:38:10 +02:00
parent f18cb05574
commit b3988cbdf7
No known key found for this signature in database
GPG Key ID: 26703B55FB13728A
86 changed files with 157 additions and 158 deletions

View File

@ -97,10 +97,10 @@ public:
PointType right = assert_cast<const ColumnVector<PointType> &>(*columns[1]).getData()[row_num];
if (!isNaN(left))
this->data(place).value.push_back(std::pair(left, Int64(1)), arena);
this->data(place).value.push_back(std::make_pair(left, Int64(1)), arena);
if (!isNaN(right))
this->data(place).value.push_back(std::pair(right, Int64(-1)), arena);
this->data(place).value.push_back(std::make_pair(right, Int64(-1)), arena);
}
void merge(AggregateDataPtr __restrict place, ConstAggregateDataPtr rhs, Arena * arena) const override

View File

@ -176,7 +176,7 @@ private:
}
else if (event_idx == 0)
{
events_timestamp[0] = std::pair(timestamp, timestamp);
events_timestamp[0] = std::make_pair(timestamp, timestamp);
first_event = true;
}
else if (strict_deduplication && events_timestamp[event_idx].has_value())
@ -199,7 +199,7 @@ private:
time_matched = time_matched && events_timestamp[event_idx - 1]->second < timestamp;
if (time_matched)
{
events_timestamp[event_idx] = std::pair(first_timestamp, timestamp);
events_timestamp[event_idx] = std::make_pair(first_timestamp, timestamp);
if (event_idx + 1 == events_size)
return events_size;
}

View File

@ -39,7 +39,7 @@ std::pair<MutableColumnPtr, MutableColumnPtr> createColumns(size_t n, size_t k)
}
auto sparse = ColumnSparse::create(std::move(values), std::move(offsets), n);
return {std::move(sparse), std::move(full)};
return std::make_pair(std::move(sparse), std::move(full));
}
bool checkEquals(const IColumn & lhs, const IColumn & rhs)

View File

@ -122,9 +122,9 @@ public:
throw Exception("No available data.", ErrorCodes::NO_AVAILABLE_DATA);
if (fits_in_byte)
return {current_bucket_index - 1, locus.read(value_l)};
return std::make_pair(current_bucket_index - 1, locus.read(value_l));
else
return {current_bucket_index - 1, locus.read(value_l, value_r)};
return std::make_pair(current_bucket_index - 1, locus.read(value_l, value_r));
}
private:

View File

@ -104,7 +104,7 @@ static ElementIdentifier getElementIdentifier(Node * element)
subst_name_pos != ConfigProcessor::SUBSTITUTION_ATTRS.end())
continue;
std::string value = node->nodeValue();
attrs_kv.push_back({name, value});
attrs_kv.push_back(std::make_pair(name, value));
}
::sort(attrs_kv.begin(), attrs_kv.end());

View File

@ -509,7 +509,7 @@ bool LRUFileCache::tryReserve(
return false;
if (cell_for_reserve && !cell_for_reserve->queue_iterator)
cell_for_reserve->queue_iterator = queue.insert(queue.end(), {key_, offset_});
cell_for_reserve->queue_iterator = queue.insert(queue.end(), std::make_pair(key_, offset_));
for (auto & cell : to_evict)
{

View File

@ -174,7 +174,7 @@ private:
: file_segment(std::move(other.file_segment))
, queue_iterator(other.queue_iterator) {}
std::pair<Key, size_t> getKeyAndOffset() const { return {file_segment->key(), file_segment->range().left}; }
std::pair<Key, size_t> getKeyAndOffset() const { return std::make_pair(file_segment->key(), file_segment->range().left); }
};
using FileSegmentsByOffset = std::map<size_t, FileSegmentCell>;

View File

@ -150,7 +150,7 @@ public:
{
/// Cell contains element return it and put to the end of lru list
lru_list.splice(lru_list.end(), lru_list, lru_list.iterator_to(*it));
return {it, false};
return std::make_pair(it, false);
}
if (size() == max_size)
@ -181,7 +181,7 @@ public:
/// Put cell to the end of lru list
lru_list.insert(lru_list.end(), *it);
return {it, true};
return std::make_pair(it, true);
}
LookupResult ALWAYS_INLINE find(const Key & key)

View File

@ -95,7 +95,7 @@ public:
if (val)
{
++hits;
return {val, false};
return std::make_pair(val, false);
}
auto & token = insert_tokens[key];
@ -115,7 +115,7 @@ public:
{
/// Another thread already produced the value while we waited for token->mutex.
++hits;
return {token->value, false};
return std::make_pair(token->value, false);
}
++misses;
@ -136,7 +136,7 @@ public:
if (!token->cleaned_up)
token_holder.cleanup(token_lock, cache_lock);
return {token->value, result};
return std::make_pair(token->value, result);
}
void getStats(size_t & out_hits, size_t & out_misses) const

View File

@ -144,7 +144,7 @@ protected:
auto getPoolExtendedStates() const
{
std::lock_guard lock(pool_states_mutex);
return std::tuple(shared_pool_states, nested_pools, last_error_decrease_time);
return std::make_tuple(shared_pool_states, nested_pools, last_error_decrease_time);
}
NestedPools nested_pools;

View File

@ -87,7 +87,7 @@ size_t TLDListsHolder::parseAndAddTldList(const std::string & name, const std::s
size_t tld_list_size = tld_list.size();
std::lock_guard<std::mutex> lock(tld_lists_map_mutex);
tld_lists_map.insert({name, std::move(tld_list)});
tld_lists_map.insert(std::make_pair(name, std::move(tld_list)));
return tld_list_size;
}

View File

@ -170,7 +170,7 @@ public:
thread_id = thread_id,
state = state,
func = std::forward<Function>(func),
args = std::tuple(std::forward<Args>(args)...)]() mutable /// mutable is needed to destroy capture
args = std::make_tuple(std::forward<Args>(args)...)]() mutable /// mutable is needed to destroy capture
{
auto event = std::move(state);
SCOPE_EXIT(event->set());

View File

@ -44,7 +44,7 @@ public:
Value value(std::forward<Args>(args)...);
auto node = std::pair(key, std::move(value));
auto node = std::make_pair(key, std::move(value));
list.push_back(std::move(node));
@ -52,7 +52,7 @@ public:
hash_map[key] = inserted_iterator;
return std::pair(&inserted_iterator->second, true);
return std::make_pair(&inserted_iterator->second, true);
}
else
{
@ -61,7 +61,7 @@ public:
list.splice(list.end(), list, iterator_in_list_to_update);
iterator_in_list_to_update = --list.end();
return std::pair(&iterator_in_list_to_update->second, false);
return std::make_pair(&iterator_in_list_to_update->second, false);
}
}

View File

@ -829,7 +829,7 @@ int main(int argc, char ** argv)
for (size_t i = 0; i < num_threads; ++i)
for (auto it = local_maps[i].begin(); it != local_maps[i].end(); ++it)
global_map.insert(std::pair(it->first, 0)).first->second += it->second;
global_map.insert(std::make_pair(it->first, 0)).first->second += it->second;
pool.wait();

View File

@ -182,11 +182,11 @@ std::vector<std::pair<String, uint16_t>> parseRemoteDescriptionForExternalDataba
if (colon == String::npos)
{
LOG_WARNING(&Poco::Logger::get("ParseRemoteDescription"), "Port is not found for host: {}. Using default port {}", address, default_port);
result.emplace_back(std::pair(address, default_port));
result.emplace_back(std::make_pair(address, default_port));
}
else
{
result.emplace_back(std::pair(address.substr(0, colon), DB::parseFromString<UInt16>(address.substr(colon + 1))));
result.emplace_back(std::make_pair(address.substr(0, colon), DB::parseFromString<UInt16>(address.substr(colon + 1))));
}
}

View File

@ -594,7 +594,7 @@ TEST_P(CodecTestPerformance, TranscodingWithDataType)
double mean{};
if (values.size() < 2)
return std::tuple(mean, double{});
return std::make_tuple(mean, double{});
using ValueType = typename std::decay_t<decltype(values)>::value_type;
std::vector<ValueType> tmp_v(std::begin(values), std::end(values));
@ -618,7 +618,7 @@ TEST_P(CodecTestPerformance, TranscodingWithDataType)
}
std_dev = std::sqrt(std_dev / tmp_v.size());
return std::tuple(mean, std_dev);
return std::make_tuple(mean, std_dev);
};
std::cerr << codec_spec.codec_statement

View File

@ -140,10 +140,10 @@ public:
it->getMapped() = itr;
updateDataSize(INSERT, key.size(), value.sizeInBytes(), 0);
return {it, true};
return std::make_pair(it, true);
}
return {it, false};
return std::make_pair(it, false);
}
void insertOrReplace(const std::string & key, const V & value)
@ -311,7 +311,7 @@ public:
std::pair<size_t, size_t> snapshotSizeWithVersion() const
{
return {list.size(), current_version};
return std::make_pair(list.size(), current_version);
}
uint64_t getApproximateDataSize() const

View File

@ -529,7 +529,7 @@ SettingFieldCustom & BaseSettings<TTraits>::getCustomSetting(const std::string_v
if (it == custom_settings_map.end())
{
auto new_name = std::make_shared<String>(name);
it = custom_settings_map.emplace(*new_name, std::pair(new_name, SettingFieldCustom{})).first;
it = custom_settings_map.emplace(*new_name, std::make_pair(new_name, SettingFieldCustom{})).first;
}
return it->second.second;
}

View File

@ -13,14 +13,14 @@ void registerDataTypeDomainGeo(DataTypeFactory & factory)
// Custom type for point represented as its coordinates stored as Tuple(Float64, Float64)
factory.registerSimpleDataTypeCustom("Point", []
{
return std::pair(DataTypeFactory::instance().get("Tuple(Float64, Float64)"),
return std::make_pair(DataTypeFactory::instance().get("Tuple(Float64, Float64)"),
std::make_unique<DataTypeCustomDesc>(std::make_unique<DataTypePointName>()));
});
// Custom type for simple polygon without holes stored as Array(Point)
factory.registerSimpleDataTypeCustom("Ring", []
{
return std::pair(DataTypeFactory::instance().get("Array(Point)"),
return std::make_pair(DataTypeFactory::instance().get("Array(Point)"),
std::make_unique<DataTypeCustomDesc>(std::make_unique<DataTypeRingName>()));
});
@ -28,14 +28,14 @@ void registerDataTypeDomainGeo(DataTypeFactory & factory)
// First element of outer array is outer shape of polygon and all the following are holes
factory.registerSimpleDataTypeCustom("Polygon", []
{
return std::pair(DataTypeFactory::instance().get("Array(Ring)"),
return std::make_pair(DataTypeFactory::instance().get("Array(Ring)"),
std::make_unique<DataTypeCustomDesc>(std::make_unique<DataTypePolygonName>()));
});
// Custom type for multiple polygons with holes stored as Array(Polygon)
factory.registerSimpleDataTypeCustom("MultiPolygon", []
{
return std::pair(DataTypeFactory::instance().get("Array(Polygon)"),
return std::make_pair(DataTypeFactory::instance().get("Array(Polygon)"),
std::make_unique<DataTypeCustomDesc>(std::make_unique<DataTypeMultiPolygonName>()));
});
}

View File

@ -10,14 +10,14 @@ void registerDataTypeDomainIPv4AndIPv6(DataTypeFactory & factory)
factory.registerSimpleDataTypeCustom("IPv4", []
{
auto type = DataTypeFactory::instance().get("UInt32");
return std::pair(type, std::make_unique<DataTypeCustomDesc>(
return std::make_pair(type, std::make_unique<DataTypeCustomDesc>(
std::make_unique<DataTypeCustomFixedName>("IPv4"), std::make_unique<SerializationIPv4>(type->getDefaultSerialization())));
});
factory.registerSimpleDataTypeCustom("IPv6", []
{
auto type = DataTypeFactory::instance().get("FixedString(16)");
return std::pair(type, std::make_unique<DataTypeCustomDesc>(
return std::make_pair(type, std::make_unique<DataTypeCustomDesc>(
std::make_unique<DataTypeCustomFixedName>("IPv6"), std::make_unique<SerializationIPv6>(type->getDefaultSerialization())));
});

View File

@ -139,7 +139,7 @@ static std::pair<DataTypePtr, DataTypeCustomDescPtr> create(const ASTPtr & argum
DataTypeCustomNamePtr custom_name = std::make_unique<DataTypeCustomSimpleAggregateFunction>(function, argument_types, params_row);
return {storage_type, std::make_unique<DataTypeCustomDesc>(std::move(custom_name), nullptr)};
return std::make_pair(storage_type, std::make_unique<DataTypeCustomDesc>(std::move(custom_name), nullptr));
}
void registerDataTypeDomainSimpleAggregateFunction(DataTypeFactory & factory)

View File

@ -10,7 +10,7 @@ void registerDataTypeDomainBool(DataTypeFactory & factory)
factory.registerSimpleDataTypeCustom("Bool", []
{
auto type = DataTypeFactory::instance().get("UInt8");
return std::pair(type, std::make_unique<DataTypeCustomDesc>(
return std::make_pair(type, std::make_unique<DataTypeCustomDesc>(
std::make_unique<DataTypeCustomFixedName>("Bool"), std::make_unique<SerializationBool>(type->getDefaultSerialization())));
});

View File

@ -56,7 +56,7 @@ static std::pair<DataTypePtr, DataTypeCustomDescPtr> create(const ASTPtr & argum
auto data_type = std::make_shared<DataTypeArray>(std::make_shared<DataTypeTuple>(nested_types, nested_names));
auto custom_name = std::make_unique<DataTypeNestedCustomName>(nested_types, nested_names);
return {std::move(data_type), std::make_unique<DataTypeCustomDesc>(std::move(custom_name))};
return std::make_pair(std::move(data_type), std::make_unique<DataTypeCustomDesc>(std::move(custom_name)));
}
void registerDataTypeNested(DataTypeFactory & factory)

View File

@ -229,7 +229,7 @@ static inline std::pair<llvm::Value *, llvm::Value *> nativeCastToCommon(llvm::I
auto * cast_lhs_to_common = nativeCast(b, lhs_type, lhs, common);
auto * cast_rhs_to_common = nativeCast(b, rhs_type, rhs, common);
return {cast_lhs_to_common, cast_rhs_to_common};
return std::make_pair(cast_lhs_to_common, cast_rhs_to_common);
}
static inline llvm::Constant * getColumnNativeValue(llvm::IRBuilderBase & builder, const DataTypePtr & column_type, const IColumn & column, size_t index)

View File

@ -451,7 +451,7 @@ ColumnWithTypeAndDimensions createTypeFromNode(const Node * node)
auto tuple_names = extractVector<0>(tuple_elements);
auto tuple_columns = extractVector<1>(tuple_elements);
return std::tuple(std::move(tuple_names), std::move(tuple_columns));
return std::make_tuple(std::move(tuple_names), std::move(tuple_columns));
};
if (node->kind == Node::SCALAR)
@ -612,7 +612,7 @@ std::pair<ColumnPtr, DataTypePtr> unflattenTuple(
}
auto [column, type, _] = createTypeFromNode(tree.getRoot());
return {std::move(column), std::move(type)};
return std::make_pair(std::move(column), std::move(type));
}
static void addConstantToWithClause(const ASTPtr & query, const String & column_name, const DataTypePtr & data_type)

View File

@ -95,7 +95,7 @@ void DatabaseAtomic::attachTable(ContextPtr /* context_ */, const String & name,
auto table_id = table->getStorageID();
assertDetachedTableNotInUse(table_id.uuid);
DatabaseOrdinary::attachTableUnlocked(name, table, lock);
table_name_to_path.emplace(std::pair(name, relative_table_path));
table_name_to_path.emplace(std::make_pair(name, relative_table_path));
}
StoragePtr DatabaseAtomic::detachTable(ContextPtr /* context */, const String & name)

View File

@ -163,7 +163,7 @@ DatabasePtr DatabaseFactory::getImpl(const ASTCreateQuery & create, const String
auto [common_configuration, storage_specific_args, settings_changes] = named_collection.value();
configuration.set(common_configuration);
configuration.addresses = {std::pair(configuration.host, configuration.port)};
configuration.addresses = {std::make_pair(configuration.host, configuration.port)};
mysql_settings.applyChanges(settings_changes);
if (!storage_specific_args.empty())
@ -303,7 +303,7 @@ DatabasePtr DatabaseFactory::getImpl(const ASTCreateQuery & create, const String
auto [common_configuration, storage_specific_args, _] = named_collection.value();
configuration.set(common_configuration);
configuration.addresses = {std::pair(configuration.host, configuration.port)};
configuration.addresses = {std::make_pair(configuration.host, configuration.port)};
for (const auto & [arg_name, arg_value] : storage_specific_args)
{

View File

@ -234,7 +234,7 @@ void DatabaseMySQL::fetchLatestTablesStructureIntoCache(
local_tables_cache.erase(iterator);
}
local_tables_cache[table_name] = std::pair(
local_tables_cache[table_name] = std::make_pair(
table_modification_time,
std::make_shared<StorageMySQL>(
StorageID(database_name, table_name),

View File

@ -156,8 +156,7 @@ static std::tuple<String, String> tryExtractTableNameFromDDL(const String & ddl)
{
String table_name;
String database_name;
if (ddl.empty())
return {database_name, table_name};
if (ddl.empty()) return std::make_tuple(database_name, table_name);
bool parse_failed = false;
Tokens tokens(ddl.data(), ddl.data() + ddl.size());
@ -205,7 +204,7 @@ static std::tuple<String, String> tryExtractTableNameFromDDL(const String & ddl)
table_name = table_id.table_name;
}
}
return {database_name, table_name};
return std::make_tuple(database_name, table_name);
}
MaterializedMySQLSyncThread::MaterializedMySQLSyncThread(

View File

@ -702,15 +702,15 @@ private:
continue;
if (unlikely(now > cell.deadline + max_lifetime_seconds))
return {KeyState::not_found, cell_place_value};
return std::make_pair(KeyState::not_found, cell_place_value);
if (unlikely(now > cell.deadline))
return {KeyState::expired, cell_place_value};
return std::make_pair(KeyState::expired, cell_place_value);
return {KeyState::found, cell_place_value};
return std::make_pair(KeyState::found, cell_place_value);
}
return {KeyState::not_found, place_value & size_overlap_mask};
return std::make_pair(KeyState::not_found, place_value & size_overlap_mask);
}
inline size_t getCellIndexForInsert(const KeyType & key) const

View File

@ -254,7 +254,7 @@ void registerDictionarySourceHTTP(DictionarySourceFactory & factory)
{
const auto header_key = config.getString(headers_prefix + "." + key + ".name", "");
const auto header_value = config.getString(headers_prefix + "." + key + ".value", "");
header_entries.emplace_back(std::tuple(header_key, header_value));
header_entries.emplace_back(std::make_tuple(header_key, header_value));
}
}

View File

@ -73,7 +73,7 @@ void registerDictionarySourceMysql(DictionarySourceFactory & factory)
{
mysql_settings.applyChanges(named_collection->settings_changes);
configuration.set(named_collection->configuration);
configuration.addresses = {std::pair(configuration.host, configuration.port)};
configuration.addresses = {std::make_pair(configuration.host, configuration.port)};
const auto & settings = global_context->getSettingsRef();
if (!mysql_settings.isChanged("connect_timeout"))
mysql_settings.connect_timeout = settings.external_storage_connect_timeout_sec;

View File

@ -73,11 +73,11 @@ void DiskWebServer::initialize(const String & uri_path) const
}
file_path = file_path.substr(url.size());
files.emplace(std::pair(file_path, file_data));
files.emplace(std::make_pair(file_path, file_data));
LOG_TRACE(&Poco::Logger::get("DiskWeb"), "Adding file: {}, size: {}", file_path, file_data.size);
}
files.emplace(std::pair(dir_name, FileData({ .type = FileType::Directory })));
files.emplace(std::make_pair(dir_name, FileData({ .type = FileType::Directory })));
}
catch (Exception & e)
{

View File

@ -47,7 +47,7 @@ std::pair<String, DiskPtr> prepareForLocalMetadata(
auto metadata_path = getDiskMetadataPath(name, config, config_prefix, context);
fs::create_directories(metadata_path);
auto metadata_disk = std::make_shared<DiskLocal>(name + "-metadata", metadata_path, 0);
return {metadata_path, metadata_disk};
return std::make_pair(metadata_path, metadata_disk);
}

View File

@ -66,7 +66,7 @@ getJoin(const ColumnsWithTypeAndName & arguments, ContextPtr context)
throw Exception(
"Illegal type " + arguments[1].type->getName() + " of second argument of function joinGet, expected a const string.",
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);
return {storage_join, attr_name};
return std::make_pair(storage_join, attr_name);
}
template <bool or_null>

View File

@ -273,7 +273,7 @@ namespace MultiRegexps
if (known_regexps.storage.end() == it)
{
it = known_regexps.storage
.emplace(std::piecewise_construct, std::tuple(std::move(str_patterns), edit_distance), std::tuple())
.emplace(std::piecewise_construct, std::make_tuple(std::move(str_patterns), edit_distance), std::make_tuple())
.first;
it->second.setConstructor([&str_patterns = it->first.first, edit_distance]()
{

View File

@ -10,7 +10,7 @@ auto uni_int_dist(int min, int max)
std::random_device rd;
std::mt19937 mt(rd());
std::uniform_int_distribution<> dist(min, max);
return std::pair(dist, mt);
return std::make_pair(dist, mt);
}
template<class T>

View File

@ -305,7 +305,7 @@ namespace detail
if (iter == http_header_entries.end())
{
http_header_entries.emplace_back(std::pair("User-Agent", fmt::format("ClickHouse/{}", VERSION_STRING)));
http_header_entries.emplace_back(std::make_pair("User-Agent", fmt::format("ClickHouse/{}", VERSION_STRING)));
}
if (!delay_initialization)

View File

@ -168,7 +168,7 @@ JoinIdentifierPosPair CollectJoinOnKeysMatcher::getTableNumbers(const ASTPtr & l
auto left_idents_table = getTableForIdentifiers(left_ast, true, data);
auto right_idents_table = getTableForIdentifiers(right_ast, true, data);
return {left_idents_table, right_idents_table};
return std::make_pair(left_idents_table, right_idents_table);
}
const ASTIdentifier * CollectJoinOnKeysMatcher::unrollAliases(const ASTIdentifier * identifier, const Aliases & aliases)

View File

@ -161,7 +161,7 @@ ComparisonGraph::CompareResult ComparisonGraph::pathToCompareResult(Path path, b
std::optional<ComparisonGraph::Path> ComparisonGraph::findPath(size_t start, size_t finish) const
{
const auto it = dists.find({start, finish});
const auto it = dists.find(std::make_pair(start, finish));
if (it == std::end(dists))
return {};
@ -417,7 +417,7 @@ std::optional<ASTPtr> ComparisonGraph::getEqualConst(const ASTPtr & ast) const
std::optional<std::pair<Field, bool>> ComparisonGraph::getConstUpperBound(const ASTPtr & ast) const
{
if (const auto * literal = ast->as<ASTLiteral>())
return std::pair(literal->value, false);
return std::make_pair(literal->value, false);
const auto it = graph.ast_hash_to_component.find(ast->getTreeHash());
if (it == std::end(graph.ast_hash_to_component))
@ -428,13 +428,13 @@ std::optional<std::pair<Field, bool>> ComparisonGraph::getConstUpperBound(const
if (from == -1)
return std::nullopt;
return std::pair(graph.vertices[from].getConstant()->as<ASTLiteral>()->value, dists.at({from, to}) == Path::GREATER);
return std::make_pair(graph.vertices[from].getConstant()->as<ASTLiteral>()->value, dists.at({from, to}) == Path::GREATER);
}
std::optional<std::pair<Field, bool>> ComparisonGraph::getConstLowerBound(const ASTPtr & ast) const
{
if (const auto * literal = ast->as<ASTLiteral>())
return std::pair(literal->value, false);
return std::make_pair(literal->value, false);
const auto it = graph.ast_hash_to_component.find(ast->getTreeHash());
if (it == std::end(graph.ast_hash_to_component))
@ -445,7 +445,7 @@ std::optional<std::pair<Field, bool>> ComparisonGraph::getConstLowerBound(const
if (to == -1)
return std::nullopt;
return std::pair(graph.vertices[to].getConstant()->as<ASTLiteral>()->value, dists.at({from, to}) == Path::GREATER);
return std::make_pair(graph.vertices[to].getConstant()->as<ASTLiteral>()->value, dists.at({from, to}) == Path::GREATER);
}
void ComparisonGraph::dfsOrder(const Graph & asts_graph, size_t v, std::vector<bool> & visited, std::vector<size_t> & order)
@ -597,7 +597,7 @@ std::map<std::pair<size_t, size_t>, ComparisonGraph::Path> ComparisonGraph::buil
for (size_t v = 0; v < n; ++v)
for (size_t u = 0; u < n; ++u)
if (results[v][u] != inf)
path[std::pair(v, u)] = (results[v][u] == -1 ? Path::GREATER : Path::GREATER_OR_EQUAL);
path[std::make_pair(v, u)] = (results[v][u] == -1 ? Path::GREATER : Path::GREATER_OR_EQUAL);
return path;
}

View File

@ -1046,7 +1046,7 @@ private:
{
new_exception = std::current_exception();
}
return {new_object, new_exception};
return std::make_pair(new_object, new_exception);
}
/// Saves the result of the loading, calculates the time of the next update, and handles errors.

View File

@ -1146,7 +1146,7 @@ void addFoundRowAll(
for (auto it = mapped.begin(); it.ok(); ++it)
{
if (!known_rows.isKnown(std::pair(it->block, it->row_num)))
if (!known_rows.isKnown(std::make_pair(it->block, it->row_num)))
{
added.appendFromBlock<false>(*it->block, it->row_num);
++current_offset;
@ -1154,7 +1154,7 @@ void addFoundRowAll(
{
new_known_rows_ptr = std::make_unique<std::vector<KnownRowsHolder<true>::Type>>();
}
new_known_rows_ptr->push_back({it->block, it->row_num});
new_known_rows_ptr->push_back(std::make_pair(it->block, it->row_num));
if (used_flags)
{
used_flags->JoinStuff::JoinUsedFlags::setUsedOnce<true, multiple_disjuncts>(

View File

@ -782,10 +782,10 @@ static std::pair<Field, std::optional<IntervalKind>> getWithFillStep(const ASTPt
auto [field, type] = evaluateConstantExpression(node, context);
if (const auto * type_interval = typeid_cast<const DataTypeInterval *>(type.get()))
return {std::move(field), type_interval->getKind()};
return std::make_pair(std::move(field), type_interval->getKind());
if (isColumnedAsNumber(type))
return {std::move(field), std::nullopt};
return std::make_pair(std::move(field), std::nullopt);
throw Exception("Illegal type " + type->getName() + " of WITH FILL expression, must be numeric type", ErrorCodes::INVALID_WITH_FILL_EXPRESSION);
}

View File

@ -81,7 +81,7 @@ InterserverCredentials::CheckResult InterserverCredentials::isValidUser(const Us
InterserverCredentials::CheckResult InterserverCredentials::isValidUser(const std::string & user, const std::string & password) const
{
return isValidUser({user, password});
return isValidUser(std::make_pair(user, password));
}
}

View File

@ -149,7 +149,7 @@ void LogicalExpressionsOptimizer::collectDisjunctiveEqualityChains()
{
if (from_node != nullptr)
{
auto res = or_parent_map.insert({function, ParentNodes{from_node}});
auto res = or_parent_map.insert(std::make_pair(function, ParentNodes{from_node}));
if (!res.second)
throw Exception("LogicalExpressionsOptimizer: parent node information is corrupted",
ErrorCodes::LOGICAL_ERROR);

View File

@ -290,7 +290,7 @@ static std::tuple<NamesAndTypesList, NamesAndTypesList, NamesAndTypesList, NameS
const auto & primary_keys_names_and_types = getNames(*primary_keys, context, columns);
const auto & non_nullable_primary_keys_names_and_types = modifyPrimaryKeysToNonNullable(primary_keys_names_and_types, columns);
return {non_nullable_primary_keys_names_and_types, getNames(*unique_keys, context, columns), getNames(*keys, context, columns), increment_columns};
return std::make_tuple(non_nullable_primary_keys_names_and_types, getNames(*unique_keys, context, columns), getNames(*keys, context, columns), increment_columns);
}
static String getUniqueColumnName(NamesAndTypesList columns_name_and_type, const String & prefix)

View File

@ -110,7 +110,7 @@ public:
/// Create a new session from current context.
auto context = Context::createCopy(global_context);
it = sessions.insert({key, std::make_shared<NamedSessionData>(key, context, timeout, *this)}).first;
it = sessions.insert(std::make_pair(key, std::make_shared<NamedSessionData>(key, context, timeout, *this))).first;
const auto & session = it->second;
if (!thread.joinable())

View File

@ -43,7 +43,7 @@ auto eventTime()
{
const auto finish_time = std::chrono::system_clock::now();
return std::pair(time_in_seconds(finish_time), time_in_microseconds(finish_time));
return std::make_pair(time_in_seconds(finish_time), time_in_microseconds(finish_time));
}
using AuthType = AuthenticationType;
@ -85,7 +85,7 @@ NamesAndTypesList SessionLogElement::getNamesAndTypes()
{"Logout", static_cast<Int8>(SESSION_LOGOUT)}
});
#define AUTH_TYPE_NAME_AND_VALUE(v) std::pair(AuthenticationTypeInfo::get(v).raw_name, static_cast<Int8>(v))
#define AUTH_TYPE_NAME_AND_VALUE(v) std::make_pair(AuthenticationTypeInfo::get(v).raw_name, static_cast<Int8>(v))
auto identified_with_column = std::make_shared<DataTypeEnum8>(
DataTypeEnum8::Values
{

View File

@ -35,7 +35,7 @@ namespace ErrorCodes
std::pair<Field, std::shared_ptr<const IDataType>> evaluateConstantExpression(const ASTPtr & node, ContextPtr context)
{
if (ASTLiteral * literal = node->as<ASTLiteral>())
return {literal->value, applyVisitor(FieldToDataType(), literal->value)};
return std::make_pair(literal->value, applyVisitor(FieldToDataType(), literal->value));
NamesAndTypesList source_columns = {{ "_dummy", std::make_shared<DataTypeUInt8>() }};
@ -88,7 +88,7 @@ std::pair<Field, std::shared_ptr<const IDataType>> evaluateConstantExpression(co
throw Exception(ErrorCodes::BAD_ARGUMENTS,
"Element of set in IN, VALUES or LIMIT or aggregate function parameter is not a constant expression (result column is not const): {}", name);
return {result_column[0], result.type};
return std::make_pair(result_column[0], result.type);
}

View File

@ -225,7 +225,7 @@ int main(int argc, char ** argv)
std::unordered_map<Key, Value, DefaultHash<Key>>::iterator it;
for (size_t i = 0; i < n; ++i)
{
it = map.insert({data[i], value}).first;
it = map.insert(std::make_pair(data[i], value)).first;
INIT
}
@ -246,7 +246,7 @@ int main(int argc, char ** argv)
map.set_empty_key(-1ULL);
for (size_t i = 0; i < n; ++i)
{
it = map.insert({data[i], value}).first;
it = map.insert(std::make_pair(data[i], value)).first;
INIT
}
@ -266,7 +266,7 @@ int main(int argc, char ** argv)
::google::sparse_hash_map<Key, Value, DefaultHash<Key>>::iterator it;
for (size_t i = 0; i < n; ++i)
{
map.insert({data[i], value});
map.insert(std::make_pair(data[i], value));
INIT
}

View File

@ -1052,7 +1052,7 @@ static std::tuple<ASTPtr, BlockIO> executeQueryImpl(
throw;
}
return {ast, std::move(res)};
return std::make_tuple(ast, std::move(res));
}

View File

@ -23,7 +23,7 @@ bool ParserDeclareOptionImpl<recursive>::parseImpl(Pos & pos, ASTPtr & node, Exp
{
auto iterator = usage_parsers_cached.find(usage_name);
if (iterator == usage_parsers_cached.end())
iterator = usage_parsers_cached.insert({usage_name, std::make_shared<ParserKeyword>(usage_name)}).first;
iterator = usage_parsers_cached.insert(std::make_pair(usage_name, std::make_shared<ParserKeyword>(usage_name))).first;
return iterator->second;
};
@ -39,7 +39,7 @@ bool ParserDeclareOptionImpl<recursive>::parseImpl(Pos & pos, ASTPtr & node, Exp
if (option_describe.value_parser->parse(pos, value, expected))
{
found = true;
changes.insert({option_describe.option_name, value});
changes.insert(std::make_pair(option_describe.option_name, value));
break;
}
}
@ -51,7 +51,7 @@ bool ParserDeclareOptionImpl<recursive>::parseImpl(Pos & pos, ASTPtr & node, Exp
return false;
found = true;
changes.insert({option_describe.option_name, value});
changes.insert(std::make_pair(option_describe.option_name, value));
break;
}
}
@ -78,7 +78,7 @@ ASTPtr ASTDeclareOptions::clone() const
res->changes.clear();
for (const auto & [name, value] : this->changes)
res->changes.insert({name, value->clone()});
res->changes.insert(std::make_pair(name, value->clone()));
return res;
}

View File

@ -422,7 +422,7 @@ std::pair<const char *, bool> splitMultipartQuery(
++pos;
}
return {begin, pos == end};
return std::make_pair(begin, pos == end);
}

View File

@ -257,7 +257,7 @@ void PrettyCompactBlockOutputFormat::writeChunk(const Chunk & chunk, PortKind po
void registerOutputFormatPrettyCompact(FormatFactory & factory)
{
for (const auto & [name, mono_block] : {std::pair("PrettyCompact", false), std::pair("PrettyCompactMonoBlock", true)})
for (const auto & [name, mono_block] : {std::make_pair("PrettyCompact", false), std::make_pair("PrettyCompactMonoBlock", true)})
{
factory.registerOutputFormat(name, [mono_block = mono_block](
WriteBuffer & buf,

View File

@ -89,7 +89,7 @@ std::pair<std::shared_ptr<std::ostream>, std::shared_ptr<std::ostream>> HTTPServ
beginWrite(*stream);
}
return {header_stream, stream};
return std::make_pair(header_stream, stream);
}
void HTTPServerResponse::sendBuffer(const void * buffer, std::size_t length)

View File

@ -1177,7 +1177,7 @@ HTTPRequestHandlerFactoryPtr createPredefinedHandlerFactory(IServer & server, co
expression = expression.substr(6);
auto regex = getCompiledRegex(expression);
if (capturingNamedQueryParam(analyze_receive_params, regex))
headers_name_with_regex.emplace(std::pair(header_name, regex));
headers_name_with_regex.emplace(std::make_pair(header_name, regex));
}
std::shared_ptr<HandlingRuleHTTPHandlerFactory<PredefinedQueryHandler>> factory;

View File

@ -54,14 +54,14 @@ static inline auto methodsFilter(Poco::Util::AbstractConfiguration & config, con
static inline auto getExpression(const std::string & expression)
{
if (!startsWith(expression, "regex:"))
return std::pair(expression, CompiledRegexPtr{});
return std::make_pair(expression, CompiledRegexPtr{});
auto compiled_regex = std::make_shared<const re2::RE2>(expression.substr(6));
if (!compiled_regex->ok())
throw Exception("cannot compile re2: " + expression + " for http handling rule, error: " + compiled_regex->error() +
". Look at https://github.com/google/re2/wiki/Syntax for reference.", ErrorCodes::CANNOT_COMPILE_REGEXP);
return std::pair(expression, compiled_regex);
return std::make_pair(expression, compiled_regex);
}
static inline auto urlFilter(Poco::Util::AbstractConfiguration & config, const std::string & config_path) /// NOLINT
@ -85,7 +85,7 @@ static inline auto headersFilter(Poco::Util::AbstractConfiguration & config, con
{
const auto & expression = getExpression(config.getString(prefix + "." + header_name));
checkExpression("", expression); /// Check expression syntax is correct
headers_expression.emplace(std::pair(header_name, expression));
headers_expression.emplace(std::make_pair(header_name, expression));
}
return [headers_expression](const HTTPServerRequest & request)

View File

@ -541,7 +541,7 @@ std::pair<Coordination::OpNum, Coordination::XID> KeeperTCPHandler::receiveReque
if (!keeper_dispatcher->putRequest(request, session_id))
throw Exception(ErrorCodes::TIMEOUT_EXCEEDED, "Session {} already disconnected", session_id);
return {opnum, xid};
return std::make_pair(opnum, xid);
}
void KeeperTCPHandler::packageSent()

View File

@ -177,14 +177,14 @@ static auto getNameRange(const ColumnsDescription::ColumnsContainer & columns, c
for (; begin != columns.end(); ++begin)
{
if (begin->name == name_without_dot)
return std::pair(begin, std::next(begin));
return std::make_pair(begin, std::next(begin));
if (startsWith(begin->name, name_with_dot))
break;
}
if (begin == columns.end())
return std::pair(begin, begin);
return std::make_pair(begin, begin);
auto end = std::next(begin);
for (; end != columns.end(); ++end)
@ -193,7 +193,7 @@ static auto getNameRange(const ColumnsDescription::ColumnsContainer & columns, c
break;
}
return std::pair(begin, end);
return std::make_pair(begin, end);
}
void ColumnsDescription::add(ColumnDescription column, const String & after_column, bool first)

View File

@ -148,7 +148,7 @@ std::optional<ExternalDataSourceInfo> getExternalDataSourceConfiguration(
auto arg_name = function_args[0]->as<ASTIdentifier>()->name();
if (function_args[1]->as<ASTFunction>())
{
non_common_args.emplace_back(std::pair(arg_name, function_args[1]));
non_common_args.emplace_back(std::make_pair(arg_name, function_args[1]));
continue;
}
@ -177,11 +177,11 @@ std::optional<ExternalDataSourceInfo> getExternalDataSourceConfiguration(
else if (storage_settings.has(arg_name))
config_settings.emplace_back(arg_name, arg_value);
else
non_common_args.emplace_back(std::pair(arg_name, arg_value_ast));
non_common_args.emplace_back(std::make_pair(arg_name, arg_value_ast));
}
else
{
non_common_args.emplace_back(std::pair(arg_name, arg_value_ast));
non_common_args.emplace_back(std::make_pair(arg_name, arg_value_ast));
}
}
else
@ -376,13 +376,13 @@ std::optional<URLBasedDataSourceConfig> getURLBasedDataSourceConfiguration(const
for (const auto & header : header_keys)
{
const auto header_prefix = config_prefix + ".headers." + header;
configuration.headers.emplace_back(std::pair(config.getString(header_prefix + ".name"), config.getString(header_prefix + ".value")));
configuration.headers.emplace_back(std::make_pair(config.getString(header_prefix + ".name"), config.getString(header_prefix + ".value")));
}
}
else
{
auto value = config.getString(config_prefix + '.' + key);
non_common_args.emplace_back(std::pair(key, std::make_shared<ASTLiteral>(value)));
non_common_args.emplace_back(std::make_pair(key, std::make_shared<ASTLiteral>(value)));
}
}
@ -411,7 +411,7 @@ std::optional<URLBasedDataSourceConfig> getURLBasedDataSourceConfiguration(const
else if (arg_name == "structure")
configuration.structure = arg_value.safeGet<String>();
else
non_common_args.emplace_back(std::pair(arg_name, arg_value_ast));
non_common_args.emplace_back(std::make_pair(arg_name, arg_value_ast));
}
else
{

View File

@ -76,7 +76,7 @@ private:
// hdfs builder relies on an external config data storage
std::pair<String, String>& keep(const String & k, const String & v)
{
return config_stor.emplace_back(std::pair(k, v));
return config_stor.emplace_back(std::make_pair(k, v));
}
hdfsBuilder * hdfs_builder;

View File

@ -12,14 +12,14 @@ std::pair<Poco::Message::Priority, DB::LogsLevel> parseSyslogLevel(const int lev
switch (level)
{
case LOG_EMERG: [[fallthrough]];
case LOG_ALERT: return {Message::PRIO_FATAL, LogsLevel::error};
case LOG_CRIT: return {Message::PRIO_CRITICAL, LogsLevel::error};
case LOG_ERR: return {Message::PRIO_ERROR, LogsLevel::error};
case LOG_WARNING: return {Message::PRIO_WARNING, LogsLevel::warning};
case LOG_NOTICE: return {Message::PRIO_NOTICE, LogsLevel::information};
case LOG_INFO: return {Message::PRIO_INFORMATION, LogsLevel::information};
case LOG_DEBUG: return {Message::PRIO_DEBUG, LogsLevel::debug};
case LOG_ALERT: return std::make_pair(Message::PRIO_FATAL, LogsLevel::error);
case LOG_CRIT: return std::make_pair(Message::PRIO_CRITICAL, LogsLevel::error);
case LOG_ERR: return std::make_pair(Message::PRIO_ERROR, LogsLevel::error);
case LOG_WARNING: return std::make_pair(Message::PRIO_WARNING, LogsLevel::warning);
case LOG_NOTICE: return std::make_pair(Message::PRIO_NOTICE, LogsLevel::information);
case LOG_INFO: return std::make_pair(Message::PRIO_INFORMATION, LogsLevel::information);
case LOG_DEBUG: return std::make_pair(Message::PRIO_DEBUG, LogsLevel::debug);
default:
return {Message::PRIO_TRACE, LogsLevel::trace};
return std::make_pair(Message::PRIO_TRACE, LogsLevel::trace);
}
}

View File

@ -1536,7 +1536,7 @@ std::pair<bool, NameSet> IMergeTreeDataPart::canRemovePart() const
{
/// NOTE: It's needed for zero-copy replication
if (force_keep_shared_data)
return {false, NameSet{}};
return std::make_pair(false, NameSet{});
return storage.unlockSharedData(*this);
}

View File

@ -1255,7 +1255,7 @@ void MergeTreeData::loadDataParts(bool skip_sanity_checks)
continue;
if (!startsWith(it->name(), MergeTreeWriteAheadLog::WAL_FILE_NAME))
disk_parts.emplace_back(std::pair(it->name(), disk_ptr));
disk_parts.emplace_back(std::make_pair(it->name(), disk_ptr));
else if (it->name() == MergeTreeWriteAheadLog::DEFAULT_WAL_FILE_NAME && settings->in_memory_parts_enable_wal)
{
std::unique_lock lock(wal_init_lock);
@ -1814,7 +1814,7 @@ size_t MergeTreeData::clearOldWriteAheadLogs()
auto is_range_on_disk = [&block_numbers_on_disk](Int64 min_block, Int64 max_block)
{
auto lower = std::lower_bound(block_numbers_on_disk.begin(), block_numbers_on_disk.end(), std::pair(min_block, Int64(-1L)));
auto lower = std::lower_bound(block_numbers_on_disk.begin(), block_numbers_on_disk.end(), std::make_pair(min_block, Int64(-1L)));
if (lower != block_numbers_on_disk.end() && min_block >= lower->first && max_block <= lower->second)
return true;

View File

@ -962,7 +962,7 @@ public:
/// Unlock shared data part in zookeeper
/// Overridden in StorageReplicatedMergeTree
virtual std::pair<bool, NameSet> unlockSharedData(const IMergeTreeDataPart &) const { return {true, NameSet{}}; }
virtual std::pair<bool, NameSet> unlockSharedData(const IMergeTreeDataPart &) const { return std::make_pair(true, NameSet{}); }
/// Fetch part only if some replica has it on shared storage like S3
/// Overridden in StorageReplicatedMergeTree

View File

@ -158,7 +158,7 @@ bool MergeTreeDataPartChecksums::readV2(ReadBuffer & in)
}
assertChar('\n', in);
files.insert(std::pair(name, sum));
files.insert(std::make_pair(name, sum));
}
return true;

View File

@ -216,13 +216,13 @@ std::pair<MergeTreePartInfo, bool> MergeTreeDeduplicationLog::addPart(const std:
/// here then destroy whole object, check for null pointer from different
/// threads and so on.
if (deduplication_window == 0)
return {part_info, true};
return std::make_pair(part_info, true);
/// If we already have this block let's deduplicate it
if (deduplication_map.contains(block_id))
{
auto info = deduplication_map.get(block_id);
return {info, false};
return std::make_pair(info, false);
}
assert(current_writer != nullptr);
@ -241,7 +241,7 @@ std::pair<MergeTreePartInfo, bool> MergeTreeDeduplicationLog::addPart(const std:
/// Rotate and drop old logs if needed
rotateAndDropIfNeeded();
return {part_info, true};
return std::make_pair(part_info, true);
}
void MergeTreeDeduplicationLog::dropPart(const MergeTreePartInfo & drop_part_info)

View File

@ -334,7 +334,7 @@ bool MergeTreeIndexConditionBloomFilter::traverseASTIn(
size_t position = header.getPositionByName(key_ast->getColumnName());
const DataTypePtr & index_type = header.getByPosition(position).type;
const auto & converted_column = castColumn(ColumnWithTypeAndName{column, type, ""}, index_type);
out.predicate.emplace_back(std::pair(position, BloomFilterHash::hashWithColumn(index_type, converted_column, 0, row_size)));
out.predicate.emplace_back(std::make_pair(position, BloomFilterHash::hashWithColumn(index_type, converted_column, 0, row_size)));
if (function_name == "in" || function_name == "globalIn")
out.function = RPNElement::FUNCTION_IN;
@ -411,7 +411,7 @@ bool MergeTreeIndexConditionBloomFilter::traverseASTIn(
auto element_key = literal->value;
const DataTypePtr actual_type = BloomFilter::getPrimitiveType(index_type);
out.predicate.emplace_back(std::pair(position, BloomFilterHash::hashWithField(actual_type.get(), element_key)));
out.predicate.emplace_back(std::make_pair(position, BloomFilterHash::hashWithField(actual_type.get(), element_key)));
}
else
{
@ -428,7 +428,7 @@ bool MergeTreeIndexConditionBloomFilter::traverseASTIn(
const auto & array_type = assert_cast<const DataTypeArray &>(*index_type);
const auto & array_nested_type = array_type.getNestedType();
const auto & converted_column = castColumn(ColumnWithTypeAndName{column, type, ""}, array_nested_type);
out.predicate.emplace_back(std::pair(position, BloomFilterHash::hashWithColumn(array_nested_type, converted_column, 0, row_size)));
out.predicate.emplace_back(std::make_pair(position, BloomFilterHash::hashWithColumn(array_nested_type, converted_column, 0, row_size)));
}
else
{
@ -533,7 +533,7 @@ bool MergeTreeIndexConditionBloomFilter::traverseASTEquals(
out.function = RPNElement::FUNCTION_HAS;
const DataTypePtr actual_type = BloomFilter::getPrimitiveType(array_type->getNestedType());
Field converted_field = convertFieldToType(value_field, *actual_type, value_type.get());
out.predicate.emplace_back(std::pair(position, BloomFilterHash::hashWithField(actual_type.get(), converted_field)));
out.predicate.emplace_back(std::make_pair(position, BloomFilterHash::hashWithField(actual_type.get(), converted_field)));
}
}
else if (function_name == "hasAny" || function_name == "hasAll")
@ -564,7 +564,7 @@ bool MergeTreeIndexConditionBloomFilter::traverseASTEquals(
out.function = function_name == "hasAny" ?
RPNElement::FUNCTION_HAS_ANY :
RPNElement::FUNCTION_HAS_ALL;
out.predicate.emplace_back(std::pair(position, BloomFilterHash::hashWithColumn(actual_type, column, 0, column->size())));
out.predicate.emplace_back(std::make_pair(position, BloomFilterHash::hashWithColumn(actual_type, column, 0, column->size())));
}
else
{
@ -574,7 +574,7 @@ bool MergeTreeIndexConditionBloomFilter::traverseASTEquals(
out.function = function_name == "equals" ? RPNElement::FUNCTION_EQUALS : RPNElement::FUNCTION_NOT_EQUALS;
const DataTypePtr actual_type = BloomFilter::getPrimitiveType(index_type);
Field converted_field = convertFieldToType(value_field, *actual_type, value_type.get());
out.predicate.emplace_back(std::pair(position, BloomFilterHash::hashWithField(actual_type.get(), converted_field)));
out.predicate.emplace_back(std::make_pair(position, BloomFilterHash::hashWithField(actual_type.get(), converted_field)));
}
return true;
@ -602,7 +602,7 @@ bool MergeTreeIndexConditionBloomFilter::traverseASTEquals(
out.function = RPNElement::FUNCTION_HAS;
const DataTypePtr actual_type = BloomFilter::getPrimitiveType(array_type->getNestedType());
Field converted_field = convertFieldToType(value_field, *actual_type, value_type.get());
out.predicate.emplace_back(std::pair(position, BloomFilterHash::hashWithField(actual_type.get(), converted_field)));
out.predicate.emplace_back(std::make_pair(position, BloomFilterHash::hashWithField(actual_type.get(), converted_field)));
return true;
}
@ -677,7 +677,7 @@ bool MergeTreeIndexConditionBloomFilter::traverseASTEquals(
const auto & index_type = header.getByPosition(position).type;
const auto actual_type = BloomFilter::getPrimitiveType(index_type);
out.predicate.emplace_back(std::pair(position, BloomFilterHash::hashWithField(actual_type.get(), const_value)));
out.predicate.emplace_back(std::make_pair(position, BloomFilterHash::hashWithField(actual_type.get(), const_value)));
return true;
}

View File

@ -58,7 +58,7 @@ private:
auto tuple() const
{
return std::tuple(!viable, !good, columns_size, identifiers.size());
return std::make_tuple(!viable, !good, columns_size, identifiers.size());
}
/// Is condition a better candidate for moving to PREWHERE?

View File

@ -267,7 +267,7 @@ MergeTreeWriteAheadLog::tryParseMinMaxBlockNumber(const String & filename)
return {};
}
return std::pair(min_block, max_block);
return std::make_pair(min_block, max_block);
}
String MergeTreeWriteAheadLog::ActionMetadata::toJSON() const

View File

@ -440,7 +440,7 @@ void ReplicatedMergeTreeCleanupThread::getBlocksSortedByTime(zkutil::ZooKeeper &
auto status = elem.second.get();
if (status.error != Coordination::Error::ZNONODE)
{
cached_block_stats.emplace(elem.first, std::pair(status.stat.ctime, status.stat.version));
cached_block_stats.emplace(elem.first, std::make_pair(status.stat.ctime, status.stat.version));
timed_blocks.emplace_back(elem.first, status.stat.ctime, status.stat.version);
}
}

View File

@ -279,7 +279,7 @@ std::pair<bool, MergeTreeDataPartPtr> ReplicatedMergeTreePartCheckThread::findLo
if (!part)
part = storage.getActiveContainingPart(part_name);
return {exists_in_zookeeper, part};
return std::make_pair(exists_in_zookeeper, part);
}
CheckResult ReplicatedMergeTreePartCheckThread::checkPart(const String & part_name)

View File

@ -2230,7 +2230,7 @@ std::optional<std::pair<Int64, int>> ReplicatedMergeTreeMergePredicate::getDesir
if (current_version >= max_version)
return {};
return std::pair(max_version, alter_version);
return std::make_pair(max_version, alter_version);
}

View File

@ -827,7 +827,7 @@ bool MaterializedPostgreSQLConsumer::consume(std::vector<std::pair<Int32, String
/// reaload and reading from replication stream are done in the same thread, no lsn will be skipped
/// between these two events.
if (lsn.empty())
skipped_tables.emplace_back(std::pair(relation_id, relation_id_to_name[relation_id]));
skipped_tables.emplace_back(std::make_pair(relation_id, relation_id_to_name[relation_id]));
}
}

View File

@ -128,12 +128,12 @@ std::pair<String, String> PostgreSQLReplicationHandler::getSchemaAndTableName(co
/// separated by dot and with no quotes. We add double quotes in this case.
if (!postgres_schema.empty())
return {postgres_schema, table_name};
return std::make_pair(postgres_schema, table_name);
if (auto pos = table_name.find('.'); schema_as_a_part_of_table_name && pos != std::string::npos)
return {table_name.substr(0, pos), table_name.substr(pos + 1)};
return std::make_pair(table_name.substr(0, pos), table_name.substr(pos + 1));
return {"", table_name};
return std::make_pair("", table_name);
}

View File

@ -104,7 +104,7 @@ void WriteBufferToRabbitMQProducer::countRow()
reinitializeChunks();
++payload_counter;
if (!payloads.push({payload_counter, payload}))
if (!payloads.push(std::make_pair(payload_counter, payload)))
throw Exception(ErrorCodes::LOGICAL_ERROR, "Could not push to payloads queue");
}
}

View File

@ -173,7 +173,7 @@ static std::pair<FieldVectorPtr, bool> getFilterKeys(
FieldVectorPtr res = std::make_shared<FieldVector>();
auto matched_keys = traverseASTFilter(primary_key, primary_key_type, select.where(), query_info.sets, res);
return {res, !matched_keys};
return std::make_pair(res, !matched_keys);
}

View File

@ -1092,7 +1092,7 @@ std::shared_ptr<MergeMutateSelectedEntry> StorageMergeTree::selectPartsToMutate(
{
/// Shall not create a new part, but will do that later if mutation with higher version appear.
/// This is needed in order to not produce excessive mutations of non-related parts.
auto block_range = std::pair(part->info.min_block, part->info.max_block);
auto block_range = std::make_pair(part->info.min_block, part->info.max_block);
updated_version_by_block_range[block_range] = last_mutation_to_apply->first;
were_some_mutations_for_some_parts_skipped = true;
continue;
@ -1216,7 +1216,7 @@ Int64 StorageMergeTree::getUpdatedDataVersion(
const DataPartPtr & part,
std::unique_lock<std::mutex> & /* currently_processing_in_background_mutex_lock */) const
{
auto it = updated_version_by_block_range.find({part->info.min_block, part->info.max_block});
auto it = updated_version_by_block_range.find(std::make_pair(part->info.min_block, part->info.max_block));
if (it != updated_version_by_block_range.end())
return std::max(part->info.getDataVersion(), static_cast<Int64>(it->second));
else

View File

@ -247,7 +247,7 @@ StorageMySQLConfiguration StorageMySQL::getConfiguration(ASTs engine_args, Conte
{
auto [common_configuration, storage_specific_args, settings_changes] = named_collection.value();
configuration.set(common_configuration);
configuration.addresses = {std::pair(configuration.host, configuration.port)};
configuration.addresses = {std::make_pair(configuration.host, configuration.port)};
storage_settings.applyChanges(settings_changes);
for (const auto & [arg_name, arg_value] : storage_specific_args)

View File

@ -393,7 +393,7 @@ StoragePostgreSQLConfiguration StoragePostgreSQL::getConfiguration(ASTs engine_a
auto [common_configuration, storage_specific_args, _] = named_collection.value();
configuration.set(common_configuration);
configuration.addresses = {std::pair(configuration.host, configuration.port)};
configuration.addresses = {std::make_pair(configuration.host, configuration.port)};
for (const auto & [arg_name, arg_value] : storage_specific_args)
{

View File

@ -7468,11 +7468,11 @@ void StorageReplicatedMergeTree::lockSharedData(const IMergeTreeDataPart & part,
std::pair<bool, NameSet> StorageReplicatedMergeTree::unlockSharedData(const IMergeTreeDataPart & part) const
{
if (!part.volume || !part.isStoredOnDisk())
return {true, NameSet{}};
return std::make_pair(true, NameSet{});
DiskPtr disk = part.volume->getDisk();
if (!disk || !disk->supportZeroCopyReplication())
return {true, NameSet{}};
return std::make_pair(true, NameSet{});
/// If part is temporary refcount file may be absent
auto ref_count_path = fs::path(part.getFullRelativePath()) / IMergeTreeDataPart::FILE_FOR_REFERENCES_CHECK;
@ -7480,12 +7480,12 @@ std::pair<bool, NameSet> StorageReplicatedMergeTree::unlockSharedData(const IMer
{
auto ref_count = disk->getRefCount(ref_count_path);
if (ref_count > 0) /// Keep part shard info for frozen backups
return {false, NameSet{}};
return std::make_pair(false, NameSet{});
}
else
{
/// Temporary part with some absent file cannot be locked in shared mode
return {true, NameSet{}};
return std::make_pair(true, NameSet{});
}
return unlockSharedDataByID(part.getUniqueId(), getTableSharedID(), part.name, replica_name, disk, getZooKeeper(), *getSettings(), log,
@ -7590,7 +7590,7 @@ std::pair<bool, NameSet> StorageReplicatedMergeTree::unlockSharedDataByID(
}
}
return {part_has_no_more_locks, files_not_to_remove};
return std::make_pair(part_has_no_more_locks, files_not_to_remove);
}

View File

@ -912,7 +912,7 @@ void registerStorageURL(StorageFactory & factory)
auto value_literal = value.safeGet<String>();
if (header == "Range")
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Range headers are not allowed");
headers.emplace_back(std::pair(header, value_literal));
headers.emplace_back(std::make_pair(header, value_literal));
}
ASTPtr partition_by;

View File

@ -110,7 +110,7 @@ protected:
IStorage::ColumnSizeByName column_sizes;
{
StoragePtr storage = storages.at({database_name, table_name});
StoragePtr storage = storages.at(std::make_pair(database_name, table_name));
TableLockHolder table_lock;
try

View File

@ -136,7 +136,7 @@ StoragesInfoStream::StoragesInfoStream(const SelectQueryInfo & query_info, Conte
if (check_access_for_tables && !access->isGranted(AccessType::SHOW_TABLES, database_name, table_name))
continue;
storages[{database_name, iterator->name()}] = storage;
storages[std::make_pair(database_name, iterator->name())] = storage;
/// Add all combinations of flag 'active'.
for (UInt64 active : {0, 1})
@ -201,7 +201,7 @@ StoragesInfo StoragesInfoStream::next()
info.need_inactive_parts = true;
}
info.storage = storages.at({info.database, info.table});
info.storage = storages.at(std::make_pair(info.database, info.table));
try
{

View File

@ -543,7 +543,7 @@ std::pair<BlocksPtr, Block> StorageWindowView::getNewBlocks(UInt32 watermark)
continue;
new_blocks->push_back(std::move(block));
}
return {new_blocks, header};
return std::make_pair(new_blocks, header);
}
inline void StorageWindowView::fire(UInt32 watermark)

View File

@ -88,7 +88,7 @@ ReadWriteBufferFromHTTP::HTTPHeaderEntries TableFunctionURL::getHeaders() const
auto value_literal = value.safeGet<String>();
if (header == "Range")
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Range headers are not allowed");
headers.emplace_back(std::pair(header, value_literal));
headers.emplace_back(std::make_pair(header, value_literal));
}
return headers;
}