提交 a76db2ba 编写于 作者: A Alexey Milovidov

dbms: improvement [#METR-13153].

上级 0d4390c1
......@@ -211,7 +211,7 @@ inline bool likePatternIsStrstr(const String & pattern, String & res)
{
res = "";
if (pattern.size() < 2 || *pattern.begin() != '%' || *pattern.rbegin() != '%')
if (pattern.size() < 2 || pattern.front() != '%' || pattern.back() != '%')
return false;
res.reserve(pattern.size() * 2);
......
......@@ -249,7 +249,7 @@ static size_t checkColumn(const String & path, const String & name, DataTypePtr
void MergeTreePartChecker::checkDataPart(String path, const Settings & settings, const DataTypeFactory & data_type_factory,
MergeTreeData::DataPart::Checksums * out_checksums)
{
if (!path.empty() && *path.rbegin() != '/')
if (!path.empty() && path.back() != '/')
path += "/";
NamesAndTypesList columns;
......
......@@ -66,8 +66,8 @@ StorageReplicatedMergeTree::StorageReplicatedMergeTree(
log(&Logger::get(database_name_ + "." + table_name + " (StorageReplicatedMergeTree)")),
shutdown_event(false)
{
if (!zookeeper_path.empty() && *zookeeper_path.rbegin() == '/')
zookeeper_path.erase(zookeeper_path.end() - 1);
if (!zookeeper_path.empty() && zookeeper_path.back() == '/')
zookeeper_path.resize(zookeeper_path.size() - 1);
replica_path = zookeeper_path + "/replicas/" + replica_name;
bool skip_sanity_checks = false;
......@@ -2837,8 +2837,8 @@ void StorageReplicatedMergeTree::getStatus(Status & res, bool with_zk_fields)
void StorageReplicatedMergeTree::fetchPartition(const Field & partition, bool unreplicated, const String & from_)
{
String from = from_;
if (*from.rbegin() == '/')
from.erase(from.end() - 1);
if (from.back() == '/')
from.resize(from.size() - 1);
if (unreplicated)
throw Exception("Not implemented", ErrorCodes::NOT_IMPLEMENTED); /// TODO
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册