diff --git a/base/base/StringRef.h b/base/base/StringRef.h
index 171861e9ba7..f300a2d63df 100644
--- a/base/base/StringRef.h
+++ b/base/base/StringRef.h
@@ -46,9 +46,9 @@ struct StringRef
constexpr StringRef(const char * data_, size_t size_) : data(data_), size(size_) {}
- StringRef(const std::string & s) : data(s.data()), size(s.size()) {}
+ StringRef(const std::string & s) : data(s.data()), size(s.size()) {} /// NOLINT
constexpr explicit StringRef(std::string_view s) : data(s.data()), size(s.size()) {}
- constexpr StringRef(const char * data_) : StringRef(std::string_view{data_}) {}
+ constexpr StringRef(const char * data_) : StringRef(std::string_view{data_}) {} /// NOLINT
constexpr StringRef() = default;
std::string toString() const { return std::string(data, size); }
diff --git a/docs/en/operations/named-collections.md b/docs/en/operations/named-collections.md
index 93dade8dd2b..dce7938f98b 100644
--- a/docs/en/operations/named-collections.md
+++ b/docs/en/operations/named-collections.md
@@ -41,7 +41,7 @@ Example of configuration:
```
-### An example of using named connections with the s3 function
+### Example of using named connections with the s3 function
```sql
INSERT INTO FUNCTION s3(s3_mydata, url = 'https://s3.us-east-1.amazonaws.com/yourbucket/mydata/test_file.tsv.gz',
@@ -57,7 +57,7 @@ FROM s3(s3_mydata, url = 'https://s3.us-east-1.amazonaws.com/yourbucket/mydata/t
1 rows in set. Elapsed: 0.279 sec. Processed 10.00 thousand rows, 90.00 KB (35.78 thousand rows/s., 322.02 KB/s.)
```
-### An example of using named connections with an S3 table
+### Example of using named connections with an S3 table
```sql
CREATE TABLE s3_engine_table (number Int64)
@@ -72,7 +72,7 @@ SELECT * FROM s3_engine_table LIMIT 3;
└────────┘
```
-## Named connections for accessing MySQL database.
+## Named connections for accessing MySQL database
The description of parameters see [mysql](../sql-reference/table-functions/mysql.md).
@@ -94,7 +94,7 @@ Example of configuration:
```
-### An example of using named connections with the mysql function
+### Example of using named connections with the mysql function
```sql
SELECT count() FROM mysql(mymysql, table = 'test');
@@ -104,7 +104,7 @@ SELECT count() FROM mysql(mymysql, table = 'test');
└─────────┘
```
-### An example of using named connections with an MySQL table
+### Example of using named connections with an MySQL table
```sql
CREATE TABLE mytable(A Int64) ENGINE = MySQL(mymysql, table = 'test', connection_pool_size=3, replace_query=0);
@@ -115,7 +115,20 @@ SELECT count() FROM mytable;
└─────────┘
```
-### An example of using named with an external dictionary with source MySQL
+### Example of using named connections with database with engine MySQL
+
+```sql
+CREATE DATABASE mydatabase ENGINE = MySQL(mymysql);
+
+SHOW TABLES FROM mydatabase;
+
+┌─name───┐
+│ source │
+│ test │
+└────────┘
+```
+
+### Example of using named connections with an external dictionary with source MySQL
```sql
CREATE DICTIONARY dict (A Int64, B String)
@@ -130,3 +143,87 @@ SELECT dictGet('dict', 'B', 2);
│ two │
└─────────────────────────┘
```
+
+## Named connections for accessing PostgreSQL database
+
+The description of parameters see [postgresql](../sql-reference/table-functions/postgresql.md).
+
+Example of configuration:
+```xml
+
+
+
+ pguser
+ jw8s0F4
+ 127.0.0.1
+ 5432
+ test
+ test_schema
+ 8
+
+
+
+```
+
+### Example of using named connections with the postgresql function
+
+```sql
+SELECT * FROM postgresql(mypg, table = 'test');
+
+┌─a─┬─b───┐
+│ 2 │ two │
+│ 1 │ one │
+└───┴─────┘
+
+
+SELECT * FROM postgresql(mypg, table = 'test', schema = 'public');
+
+┌─a─┐
+│ 1 │
+│ 2 │
+│ 3 │
+└───┘
+```
+
+
+### Example of using named connections with database with engine PostgreSQL
+
+```sql
+CREATE TABLE mypgtable (a Int64) ENGINE = PostgreSQL(mypg, table = 'test', schema = 'public');
+
+SELECT * FROM mypgtable;
+
+┌─a─┐
+│ 1 │
+│ 2 │
+│ 3 │
+└───┘
+```
+
+### Example of using named connections with database with engine PostgreSQL
+
+```sql
+CREATE DATABASE mydatabase ENGINE = PostgreSQL(mypg);
+
+SHOW TABLES FROM mydatabase
+
+┌─name─┐
+│ test │
+└──────┘
+```
+
+### Example of using named connections with an external dictionary with source POSTGRESQL
+
+```sql
+CREATE DICTIONARY dict (a Int64, b String)
+PRIMARY KEY a
+SOURCE(POSTGRESQL(NAME mypg TABLE test))
+LIFETIME(MIN 1 MAX 2)
+LAYOUT(HASHED());
+
+SELECT dictGet('dict', 'b', 2);
+
+┌─dictGet('dict', 'b', 2)─┐
+│ two │
+└─────────────────────────┘
+```
diff --git a/docs/ru/operations/named-collections.md b/docs/ru/operations/named-collections.md
index c1085af2ddb..d39177daa12 100644
--- a/docs/ru/operations/named-collections.md
+++ b/docs/ru/operations/named-collections.md
@@ -24,7 +24,7 @@ $ cat /etc/clickhouse-server/config.d/named_collections.xml
```
-## Именованные соединения для доступа к S3.
+## Именованные соединения для доступа к S3
Описание параметров смотри [Табличная Функция S3](../sql-reference/table-functions/s3.md).
@@ -72,7 +72,7 @@ SELECT * FROM s3_engine_table LIMIT 3;
└────────┘
```
-## Пример использования именованных соединений с базой данных MySQL.
+## Пример использования именованных соединений с базой данных MySQL
Описание параметров смотри [mysql](../sql-reference/table-functions/mysql.md).
@@ -104,7 +104,7 @@ SELECT count() FROM mysql(mymysql, table = 'test');
└─────────┘
```
-### Пример использования именованных таблицей с движком mysql
+### Пример использования именованных соединений таблицей с движком mysql
```sql
CREATE TABLE mytable(A Int64) ENGINE = MySQL(mymysql, table = 'test', connection_pool_size=3, replace_query=0);
@@ -115,7 +115,20 @@ SELECT count() FROM mytable;
└─────────┘
```
-### Пример использования именованных с внешним словарем с источником mysql
+### Пример использования именованных соединений базой данных с движком MySQL
+
+```sql
+CREATE DATABASE mydatabase ENGINE = MySQL(mymysql);
+
+SHOW TABLES FROM mydatabase;
+
+┌─name───┐
+│ source │
+│ test │
+└────────┘
+```
+
+### Пример использования именованных соединений с внешним словарем с источником mysql
```sql
CREATE DICTIONARY dict (A Int64, B String)
@@ -130,3 +143,86 @@ SELECT dictGet('dict', 'B', 2);
│ two │
└─────────────────────────┘
```
+
+## Пример использования именованных соединений с базой данных PostgreSQL
+
+Описание параметров смотри [postgresql](../sql-reference/table-functions/postgresql.md).
+
+Пример конфигурации:
+```xml
+
+
+
+ pguser
+ jw8s0F4
+ 127.0.0.1
+ 5432
+ test
+ test_schema
+ 8
+
+
+
+```
+
+### Пример использования именованных соединений с табличной функцией postgresql
+
+```sql
+SELECT * FROM postgresql(mypg, table = 'test');
+
+┌─a─┬─b───┐
+│ 2 │ two │
+│ 1 │ one │
+└───┴─────┘
+
+
+SELECT * FROM postgresql(mypg, table = 'test', schema = 'public');
+
+┌─a─┐
+│ 1 │
+│ 2 │
+│ 3 │
+└───┘
+```
+
+### Пример использования именованных соединений таблицей с движком PostgreSQL
+
+```sql
+CREATE TABLE mypgtable (a Int64) ENGINE = PostgreSQL(mypg, table = 'test', schema = 'public');
+
+SELECT * FROM mypgtable;
+
+┌─a─┐
+│ 1 │
+│ 2 │
+│ 3 │
+└───┘
+```
+
+### Пример использования именованных соединений базой данных с движком PostgreSQL
+
+```sql
+CREATE DATABASE mydatabase ENGINE = PostgreSQL(mypg);
+
+SHOW TABLES FROM mydatabase
+
+┌─name─┐
+│ test │
+└──────┘
+```
+
+### Пример использования именованных соединений с внешним словарем с источником POSTGRESQL
+
+```sql
+CREATE DICTIONARY dict (a Int64, b String)
+PRIMARY KEY a
+SOURCE(POSTGRESQL(NAME mypg TABLE test))
+LIFETIME(MIN 1 MAX 2)
+LAYOUT(HASHED());
+
+SELECT dictGet('dict', 'b', 2);
+
+┌─dictGet('dict', 'b', 2)─┐
+│ two │
+└─────────────────────────┘
+```
diff --git a/programs/local/LocalServer.cpp b/programs/local/LocalServer.cpp
index eb562dfd9eb..a8546649016 100644
--- a/programs/local/LocalServer.cpp
+++ b/programs/local/LocalServer.cpp
@@ -15,6 +15,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -388,7 +389,9 @@ void LocalServer::setupUsers()
"";
ConfigurationPtr users_config;
-
+ auto & access_control = global_context->getAccessControl();
+ access_control.setPlaintextPasswordSetting(config().getBool("allow_plaintext_password", true));
+ access_control.setNoPasswordSetting(config().getBool("allow_no_password", true));
if (config().has("users_config") || config().has("config-file") || fs::exists("config.xml"))
{
const auto users_config_path = config().getString("users_config", config().getString("config-file", "config.xml"));
@@ -397,10 +400,7 @@ void LocalServer::setupUsers()
users_config = loaded_config.configuration;
}
else
- {
users_config = getConfigurationFromXMLString(minimal_default_user_xml);
- }
-
if (users_config)
global_context->setUsersConfig(users_config);
else
@@ -802,7 +802,6 @@ void LocalServer::processOptions(const OptionsDescription &, const CommandLineOp
}
-
#pragma GCC diagnostic ignored "-Wunused-function"
#pragma GCC diagnostic ignored "-Wmissing-declarations"
diff --git a/programs/server/Server.cpp b/programs/server/Server.cpp
index c65f64b6363..841dc0551f4 100644
--- a/programs/server/Server.cpp
+++ b/programs/server/Server.cpp
@@ -1069,7 +1069,9 @@ if (ThreadFuzzer::instance().isEffective())
auto & access_control = global_context->getAccessControl();
if (config().has("custom_settings_prefixes"))
access_control.setCustomSettingsPrefixes(config().getString("custom_settings_prefixes"));
-
+ ///set the allow_plaintext_and_no_password setting in context.
+ access_control.setPlaintextPasswordSetting(config().getBool("allow_plaintext_password", true));
+ access_control.setNoPasswordSetting(config().getBool("allow_no_password", true));
/// Initialize access storages.
try
{
diff --git a/programs/server/config.xml b/programs/server/config.xml
index d22dd702ca9..d34340ac995 100644
--- a/programs/server/config.xml
+++ b/programs/server/config.xml
@@ -243,7 +243,7 @@
openssl dhparam -out /etc/clickhouse-server/dhparam.pem 4096
Only file format with BEGIN DH PARAMETERS is supported.
-->
-
+
none
true
true
@@ -367,6 +367,10 @@
/var/lib/clickhouse/tmp/
+
+
+
+ `
int needs explicit cast
/// 2. customized types needs explicit cast
template
- enable_if_not_field_or_bool_or_stringlike_t &
+ enable_if_not_field_or_bool_or_stringlike_t & /// NOLINT
operator=(T && rhs);
Field & operator= (bool rhs)
@@ -409,7 +409,7 @@ public:
template
const auto & get() const
{
- auto mutable_this = const_cast *>(this);
+ auto * mutable_this = const_cast *>(this);
return mutable_this->get();
}
@@ -422,7 +422,7 @@ public:
template
const T & reinterpret() const
{
- auto mutable_this = const_cast *>(this);
+ auto * mutable_this = const_cast *>(this);
return mutable_this->reinterpret();
}
@@ -887,7 +887,7 @@ Field::Field(T && rhs, enable_if_not_field_or_bool_or_stringlike_t) //-V730
}
template
-Field::enable_if_not_field_or_bool_or_stringlike_t &
+Field::enable_if_not_field_or_bool_or_stringlike_t & /// NOLINT
Field::operator=(T && rhs)
{
auto && val = castToNearestFieldType(std::forward(rhs));
@@ -986,10 +986,10 @@ String toString(const Field & x);
template <>
struct fmt::formatter
{
- constexpr auto parse(format_parse_context & ctx)
+ static constexpr auto parse(format_parse_context & ctx)
{
- auto it = ctx.begin();
- auto end = ctx.end();
+ const auto * it = ctx.begin();
+ const auto * end = ctx.end();
/// Only support {}.
if (it != end && *it != '}')
diff --git a/src/Core/MySQL/MySQLGtid.cpp b/src/Core/MySQL/MySQLGtid.cpp
index bfd0bd02b45..43fa90b6160 100644
--- a/src/Core/MySQL/MySQLGtid.cpp
+++ b/src/Core/MySQL/MySQLGtid.cpp
@@ -21,7 +21,7 @@ void GTIDSet::tryMerge(size_t i)
intervals.erase(intervals.begin() + i + 1, intervals.begin() + i + 1 + 1);
}
-void GTIDSets::parse(const String gtid_format)
+void GTIDSets::parse(String gtid_format)
{
if (gtid_format.empty())
{
diff --git a/src/Core/MySQL/MySQLGtid.h b/src/Core/MySQL/MySQLGtid.h
index c8a571d2569..45eeaf02fa2 100644
--- a/src/Core/MySQL/MySQLGtid.h
+++ b/src/Core/MySQL/MySQLGtid.h
@@ -35,7 +35,7 @@ class GTIDSets
public:
std::vector sets;
- void parse(const String gtid_format_);
+ void parse(String gtid_format_);
void update(const GTID & other);
String toString() const;
diff --git a/src/Core/PostgreSQLProtocol.h b/src/Core/PostgreSQLProtocol.h
index dd26bf41b4a..6ccdcb4d524 100644
--- a/src/Core/PostgreSQLProtocol.h
+++ b/src/Core/PostgreSQLProtocol.h
@@ -152,7 +152,7 @@ private:
WriteBuffer * out;
public:
- MessageTransport(WriteBuffer * out_) : in(nullptr), out(out_) {}
+ explicit MessageTransport(WriteBuffer * out_) : in(nullptr), out(out_) {}
MessageTransport(ReadBuffer * in_, WriteBuffer * out_): in(in_), out(out_) {}
@@ -257,7 +257,7 @@ public:
Int32 payload_size;
FirstMessage() = delete;
- FirstMessage(int payload_size_) : payload_size(payload_size_) {}
+ explicit FirstMessage(int payload_size_) : payload_size(payload_size_) {}
};
class CancelRequest : public FirstMessage
@@ -266,7 +266,7 @@ public:
Int32 process_id = 0;
Int32 secret_key = 0;
- CancelRequest(int payload_size_) : FirstMessage(payload_size_) {}
+ explicit CancelRequest(int payload_size_) : FirstMessage(payload_size_) {}
void deserialize(ReadBuffer & in) override
{
@@ -391,7 +391,7 @@ public:
// includes username, may also include database and other runtime parameters
std::unordered_map parameters;
- StartupMessage(Int32 payload_size_) : FirstMessage(payload_size_) {}
+ explicit StartupMessage(Int32 payload_size_) : FirstMessage(payload_size_) {}
void deserialize(ReadBuffer & in) override
{
@@ -643,7 +643,7 @@ private:
const std::vector & fields_descr;
public:
- RowDescription(const std::vector & fields_descr_) : fields_descr(fields_descr_) {}
+ explicit RowDescription(const std::vector & fields_descr_) : fields_descr(fields_descr_) {}
void serialize(WriteBuffer & out) const override
{
@@ -673,7 +673,7 @@ class StringField : public ISerializable
private:
String str;
public:
- StringField(String str_) : str(str_) {}
+ explicit StringField(String str_) : str(str_) {}
void serialize(WriteBuffer & out) const override
{
@@ -703,7 +703,7 @@ private:
const std::vector> & row;
public:
- DataRow(const std::vector> & row_) : row(row_) {}
+ explicit DataRow(const std::vector> & row_) : row(row_) {}
void serialize(WriteBuffer & out) const override
{
@@ -886,7 +886,7 @@ private:
std::unordered_map> type_to_method = {};
public:
- AuthenticationManager(const std::vector> & auth_methods)
+ explicit AuthenticationManager(const std::vector> & auth_methods)
{
for (const std::shared_ptr & method : auth_methods)
{
diff --git a/src/Core/QualifiedTableName.h b/src/Core/QualifiedTableName.h
index 4642465f461..3310130629d 100644
--- a/src/Core/QualifiedTableName.h
+++ b/src/Core/QualifiedTableName.h
@@ -72,7 +72,7 @@ struct QualifiedTableName
QualifiedTableName name;
if (pos == std::string::npos)
{
- name.table = std::move(maybe_qualified_name);
+ name.table = maybe_qualified_name;
}
else if (maybe_qualified_name.find('.', pos + 1) != std::string::npos)
{
@@ -119,7 +119,7 @@ namespace fmt
template <>
struct formatter
{
- constexpr auto parse(format_parse_context & ctx)
+ static constexpr auto parse(format_parse_context & ctx)
{
return ctx.begin();
}
diff --git a/src/Core/SettingsFields.h b/src/Core/SettingsFields.h
index b27763ad0d6..474786eb963 100644
--- a/src/Core/SettingsFields.h
+++ b/src/Core/SettingsFields.h
@@ -43,7 +43,7 @@ struct SettingFieldNumber
SettingFieldNumber & operator=(Type x) { value = x; changed = true; return *this; }
SettingFieldNumber & operator=(const Field & f);
- operator Type() const { return value; }
+ operator Type() const { return value; } /// NOLINT
explicit operator Field() const { return value; }
String toString() const;
@@ -75,7 +75,7 @@ struct SettingFieldMaxThreads
SettingFieldMaxThreads & operator=(UInt64 x) { is_auto = !x; value = is_auto ? getAuto() : x; changed = true; return *this; }
SettingFieldMaxThreads & operator=(const Field & f);
- operator UInt64() const { return value; }
+ operator UInt64() const { return value; } /// NOLINT
explicit operator Field() const { return value; }
/// Writes "auto()" instead of simple "" if `is_auto==true`.
@@ -118,10 +118,10 @@ struct SettingFieldTimespan
SettingFieldTimespan & operator =(UInt64 x) { *this = Poco::Timespan{static_cast(x * microseconds_per_unit)}; return *this; }
SettingFieldTimespan & operator =(const Field & f);
- operator Poco::Timespan() const { return value; }
+ operator Poco::Timespan() const { return value; } /// NOLINT
template >
- operator std::chrono::duration() const { return std::chrono::duration_cast>(std::chrono::microseconds(value.totalMicroseconds())); }
+ operator std::chrono::duration() const { return std::chrono::duration_cast>(std::chrono::microseconds(value.totalMicroseconds())); } /// NOLINT
explicit operator UInt64() const { return value.totalMicroseconds() / microseconds_per_unit; }
explicit operator Field() const { return operator UInt64(); }
@@ -158,7 +158,7 @@ struct SettingFieldString
SettingFieldString & operator =(const char * str) { *this = std::string_view{str}; return *this; }
SettingFieldString & operator =(const Field & f) { *this = f.safeGet(); return *this; }
- operator const String &() const { return value; }
+ operator const String &() const { return value; } /// NOLINT
explicit operator Field() const { return value; }
const String & toString() const { return value; }
@@ -181,7 +181,7 @@ public:
SettingFieldChar & operator =(char c) { value = c; changed = true; return *this; }
SettingFieldChar & operator =(const Field & f);
- operator char() const { return value; }
+ operator char() const { return value; } /// NOLINT
explicit operator Field() const { return toString(); }
String toString() const { return String(&value, 1); }
@@ -207,7 +207,7 @@ struct SettingFieldURI
SettingFieldURI & operator =(const char * str) { *this = Poco::URI{str}; return *this; }
SettingFieldURI & operator =(const Field & f) { *this = f.safeGet(); return *this; }
- operator const Poco::URI &() const { return value; }
+ operator const Poco::URI &() const { return value; } /// NOLINT
explicit operator String() const { return toString(); }
explicit operator Field() const { return toString(); }
@@ -244,7 +244,7 @@ struct SettingFieldEnum
SettingFieldEnum & operator =(EnumType x) { value = x; changed = true; return *this; }
SettingFieldEnum & operator =(const Field & f) { *this = Traits::fromString(f.safeGet()); return *this; }
- operator EnumType() const { return value; }
+ operator EnumType() const { return value; } /// NOLINT
explicit operator Field() const { return toString(); }
String toString() const { return Traits::toString(value); }
@@ -272,12 +272,15 @@ void SettingFieldEnum::readBinary(ReadBuffer & in)
*this = Traits::fromString(SettingFieldEnumHelpers::readBinary(in));
}
+/// NOLINTNEXTLINE
#define DECLARE_SETTING_ENUM(ENUM_TYPE) \
DECLARE_SETTING_ENUM_WITH_RENAME(ENUM_TYPE, ENUM_TYPE)
+/// NOLINTNEXTLINE
#define IMPLEMENT_SETTING_ENUM(ENUM_TYPE, ERROR_CODE_FOR_UNEXPECTED_NAME, ...) \
IMPLEMENT_SETTING_ENUM_WITH_RENAME(ENUM_TYPE, ERROR_CODE_FOR_UNEXPECTED_NAME, __VA_ARGS__)
+/// NOLINTNEXTLINE
#define DECLARE_SETTING_ENUM_WITH_RENAME(NEW_NAME, ENUM_TYPE) \
struct SettingField##NEW_NAME##Traits \
{ \
@@ -288,6 +291,7 @@ void SettingFieldEnum::readBinary(ReadBuffer & in)
\
using SettingField##NEW_NAME = SettingFieldEnum;
+/// NOLINTNEXTLINE
#define IMPLEMENT_SETTING_ENUM_WITH_RENAME(NEW_NAME, ERROR_CODE_FOR_UNEXPECTED_NAME, ...) \
const String & SettingField##NEW_NAME##Traits::toString(typename SettingField##NEW_NAME::EnumType value) \
{ \
@@ -346,7 +350,7 @@ struct SettingFieldMultiEnum
explicit SettingFieldMultiEnum(StorageType s) : value(s) {}
explicit SettingFieldMultiEnum(const Field & f) : value(parseValueFromString(f.safeGet())) {}
- operator ValueType() const { return value; }
+ operator ValueType() const { return value; } /// NOLINT
explicit operator StorageType() const { return value.getValue(); }
explicit operator Field() const { return toString(); }
@@ -368,7 +372,7 @@ struct SettingFieldMultiEnum
}
}
- if (result.size() > 0)
+ if (!result.empty())
result.erase(result.size() - separator.size());
return result;
@@ -415,9 +419,11 @@ void SettingFieldMultiEnum::readBinary(ReadBuffer & in)
parseFromString(SettingFieldEnumHelpers::readBinary(in));
}
+/// NOLINTNEXTLINE
#define DECLARE_SETTING_MULTI_ENUM(ENUM_TYPE) \
DECLARE_SETTING_MULTI_ENUM_WITH_RENAME(ENUM_TYPE, ENUM_TYPE)
+/// NOLINTNEXTLINE
#define DECLARE_SETTING_MULTI_ENUM_WITH_RENAME(ENUM_TYPE, NEW_NAME) \
struct SettingField##NEW_NAME##Traits \
{ \
@@ -429,9 +435,11 @@ void SettingFieldMultiEnum::readBinary(ReadBuffer & in)
\
using SettingField##NEW_NAME = SettingFieldMultiEnum;
+/// NOLINTNEXTLINE
#define IMPLEMENT_SETTING_MULTI_ENUM(ENUM_TYPE, ERROR_CODE_FOR_UNEXPECTED_NAME, ...) \
IMPLEMENT_SETTING_MULTI_ENUM_WITH_RENAME(ENUM_TYPE, ERROR_CODE_FOR_UNEXPECTED_NAME, __VA_ARGS__)
+/// NOLINTNEXTLINE
#define IMPLEMENT_SETTING_MULTI_ENUM_WITH_RENAME(NEW_NAME, ERROR_CODE_FOR_UNEXPECTED_NAME, ...) \
IMPLEMENT_SETTING_ENUM_WITH_RENAME(NEW_NAME, ERROR_CODE_FOR_UNEXPECTED_NAME, __VA_ARGS__)\
size_t SettingField##NEW_NAME##Traits::getEnumSize() {\
diff --git a/src/Core/SortCursor.h b/src/Core/SortCursor.h
index dd804bd4675..a5daba9fbee 100644
--- a/src/Core/SortCursor.h
+++ b/src/Core/SortCursor.h
@@ -53,7 +53,7 @@ struct SortCursorImpl
*/
IColumn::Permutation * permutation = nullptr;
- SortCursorImpl() {}
+ SortCursorImpl() = default;
SortCursorImpl(const Block & block, const SortDescription & desc_, size_t order_ = 0, IColumn::Permutation * perm = nullptr)
: desc(desc_), sort_columns_size(desc.size()), order(order_), need_collation(desc.size())
@@ -140,7 +140,7 @@ struct SortCursorHelper
const Derived & derived() const { return static_cast(*this); }
- SortCursorHelper(SortCursorImpl * impl_) : impl(impl_) {}
+ explicit SortCursorHelper(SortCursorImpl * impl_) : impl(impl_) {}
SortCursorImpl * operator-> () { return impl; }
const SortCursorImpl * operator-> () const { return impl; }
@@ -245,7 +245,7 @@ public:
SortingHeap() = default;
template
- SortingHeap(Cursors & cursors)
+ explicit SortingHeap(Cursors & cursors)
{
size_t size = cursors.size();
queue.reserve(size);
diff --git a/src/DataTypes/DataTypeArray.h b/src/DataTypes/DataTypeArray.h
index 564dbba8503..122ac8e03a3 100644
--- a/src/DataTypes/DataTypeArray.h
+++ b/src/DataTypes/DataTypeArray.h
@@ -17,7 +17,7 @@ private:
public:
static constexpr bool is_parametric = true;
- DataTypeArray(const DataTypePtr & nested_);
+ explicit DataTypeArray(const DataTypePtr & nested_);
TypeIndex getTypeId() const override { return TypeIndex::Array; }
diff --git a/src/DataTypes/DataTypeCustom.h b/src/DataTypes/DataTypeCustom.h
index 55796e3cc7a..e8e4160af07 100644
--- a/src/DataTypes/DataTypeCustom.h
+++ b/src/DataTypes/DataTypeCustom.h
@@ -19,7 +19,7 @@ class IColumn;
class IDataTypeCustomName
{
public:
- virtual ~IDataTypeCustomName() {}
+ virtual ~IDataTypeCustomName() = default;
virtual String getName() const = 0;
};
@@ -33,7 +33,7 @@ struct DataTypeCustomDesc
DataTypeCustomNamePtr name;
SerializationPtr serialization;
- DataTypeCustomDesc(
+ explicit DataTypeCustomDesc(
DataTypeCustomNamePtr name_,
SerializationPtr serialization_ = nullptr)
: name(std::move(name_))
@@ -49,7 +49,7 @@ class DataTypeCustomFixedName : public IDataTypeCustomName
private:
String name;
public:
- DataTypeCustomFixedName(String name_) : name(name_) {}
+ explicit DataTypeCustomFixedName(String name_) : name(name_) {}
String getName() const override { return name; }
};
diff --git a/src/DataTypes/DataTypeCustomSimpleAggregateFunction.h b/src/DataTypes/DataTypeCustomSimpleAggregateFunction.h
index dc054144e14..926dfd9cc82 100644
--- a/src/DataTypes/DataTypeCustomSimpleAggregateFunction.h
+++ b/src/DataTypes/DataTypeCustomSimpleAggregateFunction.h
@@ -34,7 +34,7 @@ public:
DataTypeCustomSimpleAggregateFunction(const AggregateFunctionPtr & function_, const DataTypes & argument_types_, const Array & parameters_)
: function(function_), argument_types(argument_types_), parameters(parameters_) {}
- const AggregateFunctionPtr getFunction() const { return function; }
+ AggregateFunctionPtr getFunction() const { return function; }
String getName() const override;
static void checkSupportedFunctions(const AggregateFunctionPtr & function);
};
diff --git a/src/DataTypes/DataTypeDecimalBase.h b/src/DataTypes/DataTypeDecimalBase.h
index bdb39978825..9e37de8a35b 100644
--- a/src/DataTypes/DataTypeDecimalBase.h
+++ b/src/DataTypes/DataTypeDecimalBase.h
@@ -172,14 +172,14 @@ inline auto decimalResultType(const DecimalType & tx, const DecimalType &
}
template typename DecimalType>
-inline const DecimalType decimalResultType(const DecimalType & tx, const DataTypeNumber & ty)
+inline DecimalType decimalResultType(const DecimalType & tx, const DataTypeNumber & ty)
{
const auto result_trait = DecimalUtils::binaryOpResult(tx, ty);
return DecimalType(result_trait.precision, result_trait.scale);
}
template typename DecimalType>
-inline const DecimalType decimalResultType(const DataTypeNumber & tx, const DecimalType & ty)
+inline DecimalType decimalResultType(const DataTypeNumber & tx, const DecimalType & ty)
{
const auto result_trait = DecimalUtils::binaryOpResult(tx, ty);
return DecimalType(result_trait.precision, result_trait.scale);
diff --git a/src/DataTypes/DataTypeFactory.h b/src/DataTypes/DataTypeFactory.h
index 81d7d991bdc..e7b638b6d7b 100644
--- a/src/DataTypes/DataTypeFactory.h
+++ b/src/DataTypes/DataTypeFactory.h
@@ -51,7 +51,6 @@ public:
private:
const Value & findCreatorByName(const String & family_name) const;
-private:
DataTypesDictionary data_types;
/// Case insensitive data types will be additionally added here with lowercased name.
diff --git a/src/DataTypes/DataTypeFixedString.h b/src/DataTypes/DataTypeFixedString.h
index a53fde42b29..7c089866b23 100644
--- a/src/DataTypes/DataTypeFixedString.h
+++ b/src/DataTypes/DataTypeFixedString.h
@@ -29,7 +29,7 @@ public:
static constexpr bool is_parametric = true;
static constexpr auto type_id = TypeIndex::FixedString;
- DataTypeFixedString(size_t n_) : n(n_)
+ explicit DataTypeFixedString(size_t n_) : n(n_)
{
if (n == 0)
throw Exception("FixedString size must be positive", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
diff --git a/src/DataTypes/DataTypeFunction.h b/src/DataTypes/DataTypeFunction.h
index 489ed4545f4..888bcb6a775 100644
--- a/src/DataTypes/DataTypeFunction.h
+++ b/src/DataTypes/DataTypeFunction.h
@@ -19,7 +19,7 @@ public:
bool isParametric() const override { return true; }
/// Some types could be still unknown.
- DataTypeFunction(const DataTypes & argument_types_ = DataTypes(), const DataTypePtr & return_type_ = nullptr)
+ explicit DataTypeFunction(const DataTypes & argument_types_ = DataTypes(), const DataTypePtr & return_type_ = nullptr)
: argument_types(argument_types_), return_type(return_type_) {}
std::string doGetName() const override;
diff --git a/src/DataTypes/DataTypeInterval.h b/src/DataTypes/DataTypeInterval.h
index 9ef6237ec41..83d89a73460 100644
--- a/src/DataTypes/DataTypeInterval.h
+++ b/src/DataTypes/DataTypeInterval.h
@@ -25,7 +25,7 @@ public:
IntervalKind getKind() const { return kind; }
- DataTypeInterval(IntervalKind kind_) : kind(kind_) {}
+ explicit DataTypeInterval(IntervalKind kind_) : kind(kind_) {}
std::string doGetName() const override { return fmt::format("Interval{}", kind.toString()); }
const char * getFamilyName() const override { return "Interval"; }
diff --git a/src/DataTypes/DataTypeMap.h b/src/DataTypes/DataTypeMap.h
index 04377f85cfb..65bdd93ca4d 100644
--- a/src/DataTypes/DataTypeMap.h
+++ b/src/DataTypes/DataTypeMap.h
@@ -23,7 +23,7 @@ private:
public:
static constexpr bool is_parametric = true;
- DataTypeMap(const DataTypes & elems);
+ explicit DataTypeMap(const DataTypes & elems);
DataTypeMap(const DataTypePtr & key_type_, const DataTypePtr & value_type_);
TypeIndex getTypeId() const override { return TypeIndex::Map; }
diff --git a/src/DataTypes/DataTypeTuple.h b/src/DataTypes/DataTypeTuple.h
index c56e87ca22d..db122aae5df 100644
--- a/src/DataTypes/DataTypeTuple.h
+++ b/src/DataTypes/DataTypeTuple.h
@@ -26,7 +26,7 @@ private:
public:
static constexpr bool is_parametric = true;
- DataTypeTuple(const DataTypes & elems);
+ explicit DataTypeTuple(const DataTypes & elems);
DataTypeTuple(const DataTypes & elems, const Strings & names, bool serialize_names_ = true);
static bool canBeCreatedWithNames(const Strings & names);
diff --git a/src/DataTypes/DataTypesDecimal.h b/src/DataTypes/DataTypesDecimal.h
index fb590dd1d4b..0ec29e3c5f4 100644
--- a/src/DataTypes/DataTypesDecimal.h
+++ b/src/DataTypes/DataTypesDecimal.h
@@ -60,26 +60,26 @@ inline const DataTypeDecimal * checkDecimal(const IDataType & data_type)
inline UInt32 getDecimalScale(const IDataType & data_type, UInt32 default_value = std::numeric_limits::max())
{
- if (auto * decimal_type = checkDecimal(data_type))
+ if (const auto * decimal_type = checkDecimal(data_type))
return decimal_type->getScale();
- if (auto * decimal_type = checkDecimal(data_type))
+ if (const auto * decimal_type = checkDecimal(data_type))
return decimal_type->getScale();
- if (auto * decimal_type = checkDecimal(data_type))
+ if (const auto * decimal_type = checkDecimal(data_type))
return decimal_type->getScale();
- if (auto * decimal_type = checkDecimal(data_type))
+ if (const auto * decimal_type = checkDecimal(data_type))
return decimal_type->getScale();
return default_value;
}
inline UInt32 getDecimalPrecision(const IDataType & data_type)
{
- if (auto * decimal_type = checkDecimal(data_type))
+ if (const auto * decimal_type = checkDecimal(data_type))
return decimal_type->getPrecision();
- if (auto * decimal_type = checkDecimal(data_type))
+ if (const auto * decimal_type = checkDecimal(data_type))
return decimal_type->getPrecision();
- if (auto * decimal_type = checkDecimal(data_type))
+ if (const auto * decimal_type = checkDecimal(data_type))
return decimal_type->getPrecision();
- if (auto * decimal_type = checkDecimal(data_type))
+ if (const auto * decimal_type = checkDecimal(data_type))
return decimal_type->getPrecision();
return 0;
}
diff --git a/src/DataTypes/IDataType.h b/src/DataTypes/IDataType.h
index 5bc089e085f..36e1ce8ddd5 100644
--- a/src/DataTypes/IDataType.h
+++ b/src/DataTypes/IDataType.h
@@ -318,12 +318,12 @@ struct WhichDataType
{
TypeIndex idx;
- constexpr WhichDataType(TypeIndex idx_ = TypeIndex::Nothing) : idx(idx_) {}
- constexpr WhichDataType(const IDataType & data_type) : idx(data_type.getTypeId()) {}
- constexpr WhichDataType(const IDataType * data_type) : idx(data_type->getTypeId()) {}
+ constexpr WhichDataType(TypeIndex idx_ = TypeIndex::Nothing) : idx(idx_) {} /// NOLINT
+ constexpr WhichDataType(const IDataType & data_type) : idx(data_type.getTypeId()) {} /// NOLINT
+ constexpr WhichDataType(const IDataType * data_type) : idx(data_type->getTypeId()) {} /// NOLINT
// shared ptr -> is non-constexpr in gcc
- WhichDataType(const DataTypePtr & data_type) : idx(data_type->getTypeId()) {}
+ WhichDataType(const DataTypePtr & data_type) : idx(data_type->getTypeId()) {} /// NOLINT
constexpr bool isUInt8() const { return idx == TypeIndex::UInt8; }
constexpr bool isUInt16() const { return idx == TypeIndex::UInt16; }
diff --git a/src/DataTypes/Native.h b/src/DataTypes/Native.h
index b72e479cb1d..3a635d2e240 100644
--- a/src/DataTypes/Native.h
+++ b/src/DataTypes/Native.h
@@ -201,7 +201,7 @@ static inline llvm::Value * nativeCast(llvm::IRBuilder<> & b, const DataTypePtr
return nativeCast(b, from, value, n_to);
}
-static inline std::pair nativeCastToCommon(llvm::IRBuilder<> & b, const DataTypePtr & lhs_type, llvm::Value * lhs, const DataTypePtr & rhs_type, llvm::Value * rhs)
+static inline std::pair nativeCastToCommon(llvm::IRBuilder<> & b, const DataTypePtr & lhs_type, llvm::Value * lhs, const DataTypePtr & rhs_type, llvm::Value * rhs) /// NOLINT
{
llvm::Type * common;
diff --git a/src/DataTypes/Serializations/ISerialization.h b/src/DataTypes/Serializations/ISerialization.h
index b1fd4d0a9da..86d4eab289a 100644
--- a/src/DataTypes/Serializations/ISerialization.h
+++ b/src/DataTypes/Serializations/ISerialization.h
@@ -145,7 +145,7 @@ public:
/// Flag, that may help to traverse substream paths.
mutable bool visited = false;
- Substream(Type type_) : type(type_) {}
+ Substream(Type type_) : type(type_) {} /// NOLINT
String toString() const;
};
diff --git a/src/DataTypes/Serializations/SerializationArray.h b/src/DataTypes/Serializations/SerializationArray.h
index cd8cac54881..3769f8a4513 100644
--- a/src/DataTypes/Serializations/SerializationArray.h
+++ b/src/DataTypes/Serializations/SerializationArray.h
@@ -11,7 +11,7 @@ private:
SerializationPtr nested;
public:
- SerializationArray(const SerializationPtr & nested_) : nested(nested_) {}
+ explicit SerializationArray(const SerializationPtr & nested_) : nested(nested_) {}
void serializeBinary(const Field & field, WriteBuffer & ostr) const override;
void deserializeBinary(Field & field, ReadBuffer & istr) const override;
@@ -71,7 +71,7 @@ private:
{
const ColumnPtr offsets;
- SubcolumnCreator(const ColumnPtr & offsets_) : offsets(offsets_) {}
+ explicit SubcolumnCreator(const ColumnPtr & offsets_) : offsets(offsets_) {}
DataTypePtr create(const DataTypePtr & prev) const override;
SerializationPtr create(const SerializationPtr & prev) const override;
diff --git a/src/DataTypes/Serializations/SerializationBool.h b/src/DataTypes/Serializations/SerializationBool.h
index a9f4c6404b3..a5aa0ca80a2 100644
--- a/src/DataTypes/Serializations/SerializationBool.h
+++ b/src/DataTypes/Serializations/SerializationBool.h
@@ -10,7 +10,7 @@ namespace DB
class SerializationBool final : public SerializationWrapper
{
public:
- SerializationBool(const SerializationPtr & nested_);
+ explicit SerializationBool(const SerializationPtr & nested_);
void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
diff --git a/src/DataTypes/Serializations/SerializationCustomSimpleText.h b/src/DataTypes/Serializations/SerializationCustomSimpleText.h
index ba7c712f86c..21d6f8af650 100644
--- a/src/DataTypes/Serializations/SerializationCustomSimpleText.h
+++ b/src/DataTypes/Serializations/SerializationCustomSimpleText.h
@@ -15,7 +15,7 @@ class IColumn;
class SerializationCustomSimpleText : public SerializationWrapper
{
public:
- SerializationCustomSimpleText(const SerializationPtr & nested_);
+ explicit SerializationCustomSimpleText(const SerializationPtr & nested_);
// Methods that subclasses must override in order to get full serialization/deserialization support.
virtual void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override = 0;
diff --git a/src/DataTypes/Serializations/SerializationDateTime.h b/src/DataTypes/Serializations/SerializationDateTime.h
index 75334592422..f4a142483e5 100644
--- a/src/DataTypes/Serializations/SerializationDateTime.h
+++ b/src/DataTypes/Serializations/SerializationDateTime.h
@@ -11,7 +11,7 @@ namespace DB
class SerializationDateTime final : public SerializationNumber, public TimezoneMixin
{
public:
- SerializationDateTime(const TimezoneMixin & time_zone_);
+ explicit SerializationDateTime(const TimezoneMixin & time_zone_);
void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
void deserializeWholeText(IColumn & column, ReadBuffer & istr, const FormatSettings & settings) const override;
diff --git a/src/DataTypes/Serializations/SerializationEnum.h b/src/DataTypes/Serializations/SerializationEnum.h
index dfa9e74c7a1..bdd769b59c5 100644
--- a/src/DataTypes/Serializations/SerializationEnum.h
+++ b/src/DataTypes/Serializations/SerializationEnum.h
@@ -14,7 +14,7 @@ public:
using typename SerializationNumber::ColumnType;
using typename EnumValues::Values;
- SerializationEnum(const Values & values_) : EnumValues(values_) {}
+ explicit SerializationEnum(const Values & values_) : EnumValues(values_) {}
void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
void serializeTextEscaped(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
diff --git a/src/DataTypes/Serializations/SerializationFixedString.h b/src/DataTypes/Serializations/SerializationFixedString.h
index 82559d10800..c3c08b20419 100644
--- a/src/DataTypes/Serializations/SerializationFixedString.h
+++ b/src/DataTypes/Serializations/SerializationFixedString.h
@@ -12,7 +12,7 @@ private:
size_t n;
public:
- SerializationFixedString(size_t n_) : n(n_) {}
+ explicit SerializationFixedString(size_t n_) : n(n_) {}
size_t getN() const { return n; }
void serializeBinary(const Field & field, WriteBuffer & ostr) const override;
diff --git a/src/DataTypes/Serializations/SerializationIP.h b/src/DataTypes/Serializations/SerializationIP.h
index a7bf1aeb2c6..282105b6b1e 100644
--- a/src/DataTypes/Serializations/SerializationIP.h
+++ b/src/DataTypes/Serializations/SerializationIP.h
@@ -8,7 +8,7 @@ namespace DB
class SerializationIPv4 final : public SerializationCustomSimpleText
{
public:
- SerializationIPv4(const SerializationPtr & nested_);
+ explicit SerializationIPv4(const SerializationPtr & nested_);
void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
void deserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings & settings, bool whole) const override;
@@ -17,7 +17,7 @@ public:
class SerializationIPv6 : public SerializationCustomSimpleText
{
public:
- SerializationIPv6(const SerializationPtr & nested_);
+ explicit SerializationIPv6(const SerializationPtr & nested_);
void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override;
void deserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings & settings, bool whole) const override;
diff --git a/src/DataTypes/Serializations/SerializationLowCardinality.h b/src/DataTypes/Serializations/SerializationLowCardinality.h
index 5f8a2a95a25..0a3597e86c7 100644
--- a/src/DataTypes/Serializations/SerializationLowCardinality.h
+++ b/src/DataTypes/Serializations/SerializationLowCardinality.h
@@ -15,7 +15,7 @@ private:
SerializationPtr dict_inner_serialization;
public:
- SerializationLowCardinality(const DataTypePtr & dictionary_type);
+ explicit SerializationLowCardinality(const DataTypePtr & dictionary_type);
void enumerateStreams(
SubstreamPath & path,
diff --git a/src/DataTypes/Serializations/SerializationNothing.h b/src/DataTypes/Serializations/SerializationNothing.h
index 4a062931ac2..2de93a29763 100644
--- a/src/DataTypes/Serializations/SerializationNothing.h
+++ b/src/DataTypes/Serializations/SerializationNothing.h
@@ -14,7 +14,7 @@ namespace ErrorCodes
class SerializationNothing : public SimpleTextSerialization
{
private:
- [[noreturn]] void throwNoSerialization() const
+ [[noreturn]] static void throwNoSerialization()
{
throw Exception("Serialization is not implemented", ErrorCodes::NOT_IMPLEMENTED);
}
diff --git a/src/DataTypes/Serializations/SerializationNullable.h b/src/DataTypes/Serializations/SerializationNullable.h
index eb3e9bfb430..c22f2f57786 100644
--- a/src/DataTypes/Serializations/SerializationNullable.h
+++ b/src/DataTypes/Serializations/SerializationNullable.h
@@ -11,7 +11,7 @@ private:
SerializationPtr nested;
public:
- SerializationNullable(const SerializationPtr & nested_) : nested(nested_) {}
+ explicit SerializationNullable(const SerializationPtr & nested_) : nested(nested_) {}
void enumerateStreams(
SubstreamPath & path,
@@ -96,7 +96,7 @@ private:
{
const ColumnPtr null_map;
- SubcolumnCreator(const ColumnPtr & null_map_) : null_map(null_map_) {}
+ explicit SubcolumnCreator(const ColumnPtr & null_map_) : null_map(null_map_) {}
DataTypePtr create(const DataTypePtr & prev) const override;
SerializationPtr create(const SerializationPtr & prev) const override;
diff --git a/src/DataTypes/Serializations/SerializationSparse.h b/src/DataTypes/Serializations/SerializationSparse.h
index 51d9df2cb5d..54ab4853360 100644
--- a/src/DataTypes/Serializations/SerializationSparse.h
+++ b/src/DataTypes/Serializations/SerializationSparse.h
@@ -23,7 +23,7 @@ namespace DB
class SerializationSparse final : public ISerialization
{
public:
- SerializationSparse(const SerializationPtr & nested_);
+ explicit SerializationSparse(const SerializationPtr & nested_);
Kind getKind() const override { return Kind::SPARSE; }
diff --git a/src/DataTypes/Serializations/SerializationWrapper.h b/src/DataTypes/Serializations/SerializationWrapper.h
index 4cdcffc21a8..43fc7e9914a 100644
--- a/src/DataTypes/Serializations/SerializationWrapper.h
+++ b/src/DataTypes/Serializations/SerializationWrapper.h
@@ -14,7 +14,7 @@ protected:
SerializationPtr nested_serialization;
public:
- SerializationWrapper(const SerializationPtr & nested_serialization_) : nested_serialization(nested_serialization_) {}
+ explicit SerializationWrapper(const SerializationPtr & nested_serialization_) : nested_serialization(nested_serialization_) {}
const SerializationPtr & getNested() const { return nested_serialization; }
diff --git a/src/Databases/DatabaseReplicatedWorker.h b/src/Databases/DatabaseReplicatedWorker.h
index 773612e403c..6b957e567ff 100644
--- a/src/Databases/DatabaseReplicatedWorker.h
+++ b/src/Databases/DatabaseReplicatedWorker.h
@@ -30,7 +30,7 @@ public:
void shutdown() override;
static String enqueueQueryImpl(const ZooKeeperPtr & zookeeper, DDLLogEntry & entry,
- DatabaseReplicated * const database, bool committed = false);
+ DatabaseReplicated * const database, bool committed = false); /// NOLINT
private:
bool initializeMainThread() override;
diff --git a/src/Databases/IDatabase.h b/src/Databases/IDatabase.h
index 9ad33bd228f..f95653feb20 100644
--- a/src/Databases/IDatabase.h
+++ b/src/Databases/IDatabase.h
@@ -51,8 +51,8 @@ public:
/// - it maintains a list of tables but tables are loaded lazily).
virtual const StoragePtr & table() const = 0;
- IDatabaseTablesIterator(const String & database_name_) : database_name(database_name_) { }
- IDatabaseTablesIterator(String && database_name_) : database_name(std::move(database_name_)) { }
+ explicit IDatabaseTablesIterator(const String & database_name_) : database_name(database_name_) { }
+ explicit IDatabaseTablesIterator(String && database_name_) : database_name(std::move(database_name_)) { }
virtual ~IDatabaseTablesIterator() = default;
@@ -61,7 +61,7 @@ public:
const String & databaseName() const { assert(!database_name.empty()); return database_name; }
protected:
- const String database_name;
+ String database_name;
};
/// Copies list of tables and iterates through such snapshot.
@@ -72,7 +72,7 @@ private:
Tables::iterator it;
protected:
- DatabaseTablesSnapshotIterator(DatabaseTablesSnapshotIterator && other)
+ DatabaseTablesSnapshotIterator(DatabaseTablesSnapshotIterator && other) noexcept
: IDatabaseTablesIterator(std::move(other.database_name))
{
size_t idx = std::distance(other.tables.begin(), other.it);
@@ -118,7 +118,7 @@ class IDatabase : public std::enable_shared_from_this
{
public:
IDatabase() = delete;
- IDatabase(String database_name_) : database_name(std::move(database_name_)) {}
+ explicit IDatabase(String database_name_) : database_name(std::move(database_name_)) {}
/// Get name of database engine.
virtual String getEngineName() const = 0;
@@ -129,7 +129,7 @@ public:
/// Load a set of existing tables.
/// You can call only once, right after the object is created.
- virtual void loadStoredObjects(
+ virtual void loadStoredObjects( /// NOLINT
ContextMutablePtr /*context*/,
bool /*force_restore*/,
bool /*force_attach*/ = false,
@@ -175,7 +175,7 @@ public:
/// Get an iterator that allows you to pass through all the tables.
/// It is possible to have "hidden" tables that are not visible when passing through, but are visible if you get them by name using the functions above.
- virtual DatabaseTablesIteratorPtr getTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name = {}) const = 0;
+ virtual DatabaseTablesIteratorPtr getTablesIterator(ContextPtr context, const FilterByNameFunction & filter_by_table_name = {}) const = 0; /// NOLINT
/// Is the database empty.
virtual bool empty() const = 0;
@@ -191,7 +191,7 @@ public:
}
/// Delete the table from the database, drop table and delete the metadata.
- virtual void dropTable(
+ virtual void dropTable( /// NOLINT
ContextPtr /*context*/,
const String & /*name*/,
[[maybe_unused]] bool no_delay = false)
@@ -202,7 +202,7 @@ public:
/// Add a table to the database, but do not add it to the metadata. The database may not support this method.
///
/// Note: ATTACH TABLE statement actually uses createTable method.
- virtual void attachTable(ContextPtr /* context */, const String & /*name*/, const StoragePtr & /*table*/, [[maybe_unused]] const String & relative_table_path = {})
+ virtual void attachTable(ContextPtr /* context */, const String & /*name*/, const StoragePtr & /*table*/, [[maybe_unused]] const String & relative_table_path = {}) /// NOLINT
{
throw Exception("There is no ATTACH TABLE query for Database" + getEngineName(), ErrorCodes::NOT_IMPLEMENTED);
}
diff --git a/src/Databases/MySQL/MaterializedMySQLSyncThread.h b/src/Databases/MySQL/MaterializedMySQLSyncThread.h
index c7781595a85..163a3732fb9 100644
--- a/src/Databases/MySQL/MaterializedMySQLSyncThread.h
+++ b/src/Databases/MySQL/MaterializedMySQLSyncThread.h
@@ -67,12 +67,12 @@ private:
// USE MySQL ERROR CODE:
// https://dev.mysql.com/doc/mysql-errors/5.7/en/server-error-reference.html
- const int ER_ACCESS_DENIED_ERROR = 1045;
- const int ER_DBACCESS_DENIED_ERROR = 1044;
- const int ER_BAD_DB_ERROR = 1049;
+ const int ER_ACCESS_DENIED_ERROR = 1045; /// NOLINT
+ const int ER_DBACCESS_DENIED_ERROR = 1044; /// NOLINT
+ const int ER_BAD_DB_ERROR = 1049; /// NOLINT
// https://dev.mysql.com/doc/mysql-errors/8.0/en/client-error-reference.html
- const int CR_SERVER_LOST = 2013;
+ const int CR_SERVER_LOST = 2013; /// NOLINT
struct Buffers
{
@@ -88,7 +88,7 @@ private:
using BufferAndSortingColumnsPtr = std::shared_ptr;
std::unordered_map data;
- Buffers(const String & database_) : database(database_) {}
+ explicit Buffers(const String & database_) : database(database_) {}
void commit(ContextPtr context);
diff --git a/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp b/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp
index 43506b004b6..ce1ed98b977 100644
--- a/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp
+++ b/src/Databases/PostgreSQL/DatabasePostgreSQL.cpp
@@ -174,7 +174,7 @@ StoragePtr DatabasePostgreSQL::tryGetTable(const String & table_name, ContextPtr
}
-StoragePtr DatabasePostgreSQL::fetchTable(const String & table_name, ContextPtr, const bool table_checked) const
+StoragePtr DatabasePostgreSQL::fetchTable(const String & table_name, ContextPtr, bool table_checked) const
{
if (!cache_tables || !cached_tables.count(table_name))
{
diff --git a/src/Databases/PostgreSQL/DatabasePostgreSQL.h b/src/Databases/PostgreSQL/DatabasePostgreSQL.h
index d41dbff1f54..3397dcc8076 100644
--- a/src/Databases/PostgreSQL/DatabasePostgreSQL.h
+++ b/src/Databases/PostgreSQL/DatabasePostgreSQL.h
@@ -81,7 +81,7 @@ private:
bool checkPostgresTable(const String & table_name) const;
- StoragePtr fetchTable(const String & table_name, ContextPtr context, const bool table_checked) const;
+ StoragePtr fetchTable(const String & table_name, ContextPtr context, bool table_checked) const;
void removeOutdatedTables();
diff --git a/src/Dictionaries/CacheDictionaryUpdateQueue.h b/src/Dictionaries/CacheDictionaryUpdateQueue.h
index 7725ce7588f..d6a195ca7b8 100644
--- a/src/Dictionaries/CacheDictionaryUpdateQueue.h
+++ b/src/Dictionaries/CacheDictionaryUpdateQueue.h
@@ -75,7 +75,7 @@ private:
friend class CacheDictionaryUpdateQueue;
std::atomic is_done{false};
- std::exception_ptr current_exception{nullptr};
+ std::exception_ptr current_exception{nullptr}; /// NOLINT
/// While UpdateUnit is alive, it is accounted in update_queue size.
CurrentMetrics::Increment alive_batch{CurrentMetrics::CacheDictionaryUpdateQueueBatches};
diff --git a/src/Dictionaries/CassandraHelpers.h b/src/Dictionaries/CassandraHelpers.h
index 30111e11686..3b90d46acdf 100644
--- a/src/Dictionaries/CassandraHelpers.h
+++ b/src/Dictionaries/CassandraHelpers.h
@@ -23,8 +23,8 @@ class ObjectHolder
CassT * ptr = nullptr;
public:
template
- ObjectHolder(Args &&... args) : ptr(Ctor(std::forward(args)...)) {}
- ObjectHolder(CassT * ptr_) : ptr(ptr_) {}
+ ObjectHolder(Args &&... args) : ptr(Ctor(std::forward(args)...)) {} /// NOLINT
+ ObjectHolder(CassT * ptr_) : ptr(ptr_) {} /// NOLINT
ObjectHolder(const ObjectHolder &) = delete;
ObjectHolder & operator = (const ObjectHolder &) = delete;
@@ -46,8 +46,8 @@ public:
}
/// For implicit conversion when passing object to driver library functions
- operator CassT * () { return ptr; }
- operator const CassT * () const { return ptr; }
+ operator CassT * () { return ptr; } /// NOLINT
+ operator const CassT * () const { return ptr; } /// NOLINT
};
}
diff --git a/src/Dictionaries/DictionaryHelpers.h b/src/Dictionaries/DictionaryHelpers.h
index f2d7febfa8e..80b15eb2569 100644
--- a/src/Dictionaries/DictionaryHelpers.h
+++ b/src/Dictionaries/DictionaryHelpers.h
@@ -187,7 +187,7 @@ private:
DataTypes dictionary_attributes_types;
};
-static inline void insertDefaultValuesIntoColumns(
+static inline void insertDefaultValuesIntoColumns( /// NOLINT
MutableColumns & columns,
const DictionaryStorageFetchRequest & fetch_request,
size_t row_index)
@@ -206,7 +206,7 @@ static inline void insertDefaultValuesIntoColumns(
/// Deserialize column value and insert it in columns.
/// Skip unnecessary columns that were not requested from deserialization.
-static inline void deserializeAndInsertIntoColumns(
+static inline void deserializeAndInsertIntoColumns( /// NOLINT
MutableColumns & columns,
const DictionaryStorageFetchRequest & fetch_request,
const char * place_for_serialized_columns)
diff --git a/src/Dictionaries/Embedded/GeodataProviders/HierarchiesProvider.h b/src/Dictionaries/Embedded/GeodataProviders/HierarchiesProvider.h
index 198f13e0f32..c2e36f59e1e 100644
--- a/src/Dictionaries/Embedded/GeodataProviders/HierarchiesProvider.h
+++ b/src/Dictionaries/Embedded/GeodataProviders/HierarchiesProvider.h
@@ -14,7 +14,7 @@ private:
FileUpdatesTracker updates_tracker;
public:
- RegionsHierarchyDataSource(const std::string & path_) : path(path_), updates_tracker(path_) {}
+ explicit RegionsHierarchyDataSource(const std::string & path_) : path(path_), updates_tracker(path_) {}
bool isModified() const override;
@@ -40,7 +40,7 @@ public:
* For example, if /opt/geo/regions_hierarchy.txt is specified,
* then the /opt/geo/regions_hierarchy_ua.txt file will also be loaded, if any, it will be accessible by the `ua` key.
*/
- RegionsHierarchiesDataProvider(const std::string & path_);
+ explicit RegionsHierarchiesDataProvider(const std::string & path_);
std::vector listCustomHierarchies() const override;
diff --git a/src/Dictionaries/Embedded/GeodataProviders/HierarchyFormatReader.h b/src/Dictionaries/Embedded/GeodataProviders/HierarchyFormatReader.h
index 85dd8ce58b7..64f393ada62 100644
--- a/src/Dictionaries/Embedded/GeodataProviders/HierarchyFormatReader.h
+++ b/src/Dictionaries/Embedded/GeodataProviders/HierarchyFormatReader.h
@@ -11,7 +11,7 @@ private:
DB::ReadBufferPtr input;
public:
- RegionsHierarchyFormatReader(DB::ReadBufferPtr input_) : input(std::move(input_)) {}
+ explicit RegionsHierarchyFormatReader(DB::ReadBufferPtr input_) : input(std::move(input_)) {}
bool readNext(RegionEntry & entry) override;
};
diff --git a/src/Dictionaries/Embedded/GeodataProviders/IHierarchiesProvider.h b/src/Dictionaries/Embedded/GeodataProviders/IHierarchiesProvider.h
index 0606896c951..f7d51135440 100644
--- a/src/Dictionaries/Embedded/GeodataProviders/IHierarchiesProvider.h
+++ b/src/Dictionaries/Embedded/GeodataProviders/IHierarchiesProvider.h
@@ -27,7 +27,7 @@ public:
virtual IRegionsHierarchyReaderPtr createReader() = 0;
- virtual ~IRegionsHierarchyDataSource() {}
+ virtual ~IRegionsHierarchyDataSource() = default;
};
using IRegionsHierarchyDataSourcePtr = std::shared_ptr;
@@ -42,7 +42,7 @@ public:
virtual IRegionsHierarchyDataSourcePtr getDefaultHierarchySource() const = 0;
virtual IRegionsHierarchyDataSourcePtr getHierarchySource(const std::string & name) const = 0;
- virtual ~IRegionsHierarchiesDataProvider() {}
+ virtual ~IRegionsHierarchiesDataProvider() = default;
};
using IRegionsHierarchiesDataProviderPtr = std::shared_ptr;
diff --git a/src/Dictionaries/Embedded/GeodataProviders/INamesProvider.h b/src/Dictionaries/Embedded/GeodataProviders/INamesProvider.h
index 26de5d9116b..679c14d546b 100644
--- a/src/Dictionaries/Embedded/GeodataProviders/INamesProvider.h
+++ b/src/Dictionaries/Embedded/GeodataProviders/INamesProvider.h
@@ -10,7 +10,7 @@ class ILanguageRegionsNamesReader
public:
virtual bool readNext(RegionNameEntry & entry) = 0;
- virtual ~ILanguageRegionsNamesReader() {}
+ virtual ~ILanguageRegionsNamesReader() = default;
};
using ILanguageRegionsNamesReaderPtr = std::unique_ptr;
@@ -32,7 +32,7 @@ public:
virtual std::string getSourceName() const = 0;
- virtual ~ILanguageRegionsNamesDataSource() {}
+ virtual ~ILanguageRegionsNamesDataSource() = default;
};
using ILanguageRegionsNamesDataSourcePtr = std::unique_ptr;
@@ -45,7 +45,7 @@ public:
/// Returns nullptr if the language data does not exist.
virtual ILanguageRegionsNamesDataSourcePtr getLanguageRegionsNamesSource(const std::string & language) const = 0;
- virtual ~IRegionsNamesDataProvider() {}
+ virtual ~IRegionsNamesDataProvider() = default;
};
using IRegionsNamesDataProviderPtr = std::unique_ptr;
diff --git a/src/Dictionaries/Embedded/GeodataProviders/NamesFormatReader.h b/src/Dictionaries/Embedded/GeodataProviders/NamesFormatReader.h
index 573569ab115..49d324d434e 100644
--- a/src/Dictionaries/Embedded/GeodataProviders/NamesFormatReader.h
+++ b/src/Dictionaries/Embedded/GeodataProviders/NamesFormatReader.h
@@ -11,7 +11,7 @@ private:
DB::ReadBufferPtr input;
public:
- LanguageRegionsNamesFormatReader(DB::ReadBufferPtr input_) : input(std::move(input_)) {}
+ explicit LanguageRegionsNamesFormatReader(DB::ReadBufferPtr input_) : input(std::move(input_)) {}
bool readNext(RegionNameEntry & entry) override;
};
diff --git a/src/Dictionaries/Embedded/GeodataProviders/NamesProvider.h b/src/Dictionaries/Embedded/GeodataProviders/NamesProvider.h
index c380fcb7d1d..2d49cceab86 100644
--- a/src/Dictionaries/Embedded/GeodataProviders/NamesProvider.h
+++ b/src/Dictionaries/Embedded/GeodataProviders/NamesProvider.h
@@ -39,7 +39,7 @@ private:
std::string directory;
public:
- RegionsNamesDataProvider(const std::string & directory_);
+ explicit RegionsNamesDataProvider(const std::string & directory_);
ILanguageRegionsNamesDataSourcePtr getLanguageRegionsNamesSource(const std::string & language) const override;
diff --git a/src/Dictionaries/Embedded/RegionsHierarchies.h b/src/Dictionaries/Embedded/RegionsHierarchies.h
index 9626a77216d..925b7b490ff 100644
--- a/src/Dictionaries/Embedded/RegionsHierarchies.h
+++ b/src/Dictionaries/Embedded/RegionsHierarchies.h
@@ -17,7 +17,7 @@ private:
Container data;
public:
- RegionsHierarchies(IRegionsHierarchiesDataProviderPtr data_provider);
+ explicit RegionsHierarchies(IRegionsHierarchiesDataProviderPtr data_provider);
/** Reloads, if necessary, all hierarchies of regions.
*/
diff --git a/src/Dictionaries/Embedded/RegionsHierarchy.h b/src/Dictionaries/Embedded/RegionsHierarchy.h
index 45d6c5246ca..508bca0d1e1 100644
--- a/src/Dictionaries/Embedded/RegionsHierarchy.h
+++ b/src/Dictionaries/Embedded/RegionsHierarchy.h
@@ -49,7 +49,7 @@ private:
IRegionsHierarchyDataSourcePtr data_source;
public:
- RegionsHierarchy(IRegionsHierarchyDataSourcePtr data_source_);
+ explicit RegionsHierarchy(IRegionsHierarchyDataSourcePtr data_source_);
/// Reloads, if necessary, the hierarchy of regions. Not threadsafe.
void reload();
diff --git a/src/Dictionaries/Embedded/RegionsNames.h b/src/Dictionaries/Embedded/RegionsNames.h
index ff60c274401..ec06a0b1a33 100644
--- a/src/Dictionaries/Embedded/RegionsNames.h
+++ b/src/Dictionaries/Embedded/RegionsNames.h
@@ -40,7 +40,7 @@ class RegionsNames
public:
enum class Language : size_t
{
- #define M(NAME, FALLBACK, NUM) NAME = NUM,
+ #define M(NAME, FALLBACK, NUM) NAME = (NUM),
FOR_EACH_LANGUAGE(M)
#undef M
};
@@ -78,7 +78,7 @@ private:
static std::string dumpSupportedLanguagesNames();
public:
- RegionsNames(IRegionsNamesDataProviderPtr data_provider);
+ explicit RegionsNames(IRegionsNamesDataProviderPtr data_provider);
StringRef getRegionName(RegionID region_id, Language language) const
{
@@ -104,7 +104,7 @@ public:
#define M(NAME, FALLBACK, NUM) \
if (0 == language.compare(#NAME)) \
return Language::NAME;
- FOR_EACH_LANGUAGE(M)
+ FOR_EACH_LANGUAGE(M) /// NOLINT
#undef M
throw Poco::Exception("Unsupported language for region name. Supported languages are: " + dumpSupportedLanguagesNames() + ".");
}
diff --git a/src/Dictionaries/FlatDictionary.cpp b/src/Dictionaries/FlatDictionary.cpp
index 26144821a0e..cb2419633bf 100644
--- a/src/Dictionaries/FlatDictionary.cpp
+++ b/src/Dictionaries/FlatDictionary.cpp
@@ -32,13 +32,11 @@ FlatDictionary::FlatDictionary(
const StorageID & dict_id_,
const DictionaryStructure & dict_struct_,
DictionarySourcePtr source_ptr_,
- const DictionaryLifetime dict_lifetime_,
Configuration configuration_,
BlockPtr update_field_loaded_block_)
: IDictionary(dict_id_)
, dict_struct(dict_struct_)
, source_ptr{std::move(source_ptr_)}
- , dict_lifetime(dict_lifetime_)
, configuration(configuration_)
, loaded_keys(configuration.initial_array_size, false)
, update_field_loaded_block(std::move(update_field_loaded_block_))
@@ -604,18 +602,19 @@ void registerDictionaryFlat(DictionaryFactory & factory)
static constexpr size_t default_max_array_size = 500000;
String dictionary_layout_prefix = config_prefix + ".layout" + ".flat";
+ const DictionaryLifetime dict_lifetime{config, config_prefix + ".lifetime"};
FlatDictionary::Configuration configuration
{
.initial_array_size = config.getUInt64(dictionary_layout_prefix + ".initial_array_size", default_initial_array_size),
.max_array_size = config.getUInt64(dictionary_layout_prefix + ".max_array_size", default_max_array_size),
- .require_nonempty = config.getBool(config_prefix + ".require_nonempty", false)
+ .require_nonempty = config.getBool(config_prefix + ".require_nonempty", false),
+ .dict_lifetime = dict_lifetime
};
const auto dict_id = StorageID::fromDictionaryConfig(config, config_prefix);
- const DictionaryLifetime dict_lifetime{config, config_prefix + ".lifetime"};
- return std::make_unique(dict_id, dict_struct, std::move(source_ptr), dict_lifetime, std::move(configuration));
+ return std::make_unique(dict_id, dict_struct, std::move(source_ptr), std::move(configuration));
};
factory.registerLayout("flat", create_layout, false);
diff --git a/src/Dictionaries/FlatDictionary.h b/src/Dictionaries/FlatDictionary.h
index 2578fef3ecb..f342c38802d 100644
--- a/src/Dictionaries/FlatDictionary.h
+++ b/src/Dictionaries/FlatDictionary.h
@@ -26,13 +26,13 @@ public:
size_t initial_array_size;
size_t max_array_size;
bool require_nonempty;
+ DictionaryLifetime dict_lifetime;
};
FlatDictionary(
const StorageID & dict_id_,
const DictionaryStructure & dict_struct_,
DictionarySourcePtr source_ptr_,
- const DictionaryLifetime dict_lifetime_,
Configuration configuration_,
BlockPtr update_field_loaded_block_ = nullptr);
@@ -58,12 +58,12 @@ public:
std::shared_ptr clone() const override
{
- return std::make_shared(getDictionaryID(), dict_struct, source_ptr->clone(), dict_lifetime, configuration, update_field_loaded_block);
+ return std::make_shared(getDictionaryID(), dict_struct, source_ptr->clone(), configuration, update_field_loaded_block);
}
DictionarySourcePtr getSource() const override { return source_ptr; }
- const DictionaryLifetime & getLifetime() const override { return dict_lifetime; }
+ const DictionaryLifetime & getLifetime() const override { return configuration.dict_lifetime; }
const DictionaryStructure & getStructure() const override { return dict_struct; }
@@ -159,7 +159,6 @@ private:
const DictionaryStructure dict_struct;
const DictionarySourcePtr source_ptr;
- const DictionaryLifetime dict_lifetime;
const Configuration configuration;
std::vector attributes;
diff --git a/src/Dictionaries/ICacheDictionaryStorage.h b/src/Dictionaries/ICacheDictionaryStorage.h
index b094d76a9a7..a4990528a4e 100644
--- a/src/Dictionaries/ICacheDictionaryStorage.h
+++ b/src/Dictionaries/ICacheDictionaryStorage.h
@@ -22,7 +22,7 @@ struct KeyState
, fetched_column_index(fetched_column_index_)
{}
- KeyState(State state_)
+ KeyState(State state_) /// NOLINT
: state(state_)
{}
diff --git a/src/Dictionaries/IDictionary.h b/src/Dictionaries/IDictionary.h
index 042153f0971..c18dbcfbea7 100644
--- a/src/Dictionaries/IDictionary.h
+++ b/src/Dictionaries/IDictionary.h
@@ -150,7 +150,7 @@ public:
auto & key_column_to_cast = key_columns[key_attribute_type_index];
ColumnWithTypeAndName column_to_cast = {key_column_to_cast, key_type, ""};
- auto casted_column = castColumnAccurate(std::move(column_to_cast), key_attribute_type);
+ auto casted_column = castColumnAccurate(column_to_cast, key_attribute_type);
key_column_to_cast = std::move(casted_column);
key_type = key_attribute_type;
}
diff --git a/src/Dictionaries/IPAddressDictionary.h b/src/Dictionaries/IPAddressDictionary.h
index 8dddc988caa..894af5ceb71 100644
--- a/src/Dictionaries/IPAddressDictionary.h
+++ b/src/Dictionaries/IPAddressDictionary.h
@@ -26,7 +26,7 @@ public:
const StorageID & dict_id_,
const DictionaryStructure & dict_struct_,
DictionarySourcePtr source_ptr_,
- const DictionaryLifetime dict_lifetime_,
+ const DictionaryLifetime dict_lifetime_, /// NOLINT
bool require_nonempty_);
std::string getKeyDescription() const { return key_description; }
@@ -160,7 +160,7 @@ private:
template
static void createAttributeImpl(Attribute & attribute, const Field & null_value);
- static Attribute createAttributeWithType(const AttributeUnderlyingType type, const Field & null_value);
+ static Attribute createAttributeWithType(const AttributeUnderlyingType type, const Field & null_value); /// NOLINT
template
void getItemsByTwoKeyColumnsImpl(
@@ -177,7 +177,7 @@ private:
DefaultValueExtractor & default_value_extractor) const;
template
- void setAttributeValueImpl(Attribute & attribute, const T value);
+ void setAttributeValueImpl(Attribute & attribute, const T value); /// NOLINT
void setAttributeValue(Attribute & attribute, const Field & value);
diff --git a/src/Dictionaries/PolygonDictionaryUtils.h b/src/Dictionaries/PolygonDictionaryUtils.h
index 0aca7cd8af0..9d6d6ae0501 100644
--- a/src/Dictionaries/PolygonDictionaryUtils.h
+++ b/src/Dictionaries/PolygonDictionaryUtils.h
@@ -38,7 +38,7 @@ public:
SlabsPolygonIndex() = default;
/** Builds an index by splitting all edges with all points x coordinates. */
- SlabsPolygonIndex(const std::vector & polygons);
+ explicit SlabsPolygonIndex(const std::vector & polygons);
/** Finds polygon id the same way as IPolygonIndex. */
bool find(const Point & point, size_t & id) const;
@@ -179,7 +179,7 @@ class GridRoot : public ICell
{
public:
GridRoot(size_t min_intersections_, size_t max_depth_, const std::vector & polygons_):
- kMinIntersections(min_intersections_), kMaxDepth(max_depth_), polygons(polygons_)
+ k_min_intersections(min_intersections_), k_max_depth(max_depth_), polygons(polygons_)
{
setBoundingBox();
std::vector order(polygons.size());
@@ -209,8 +209,8 @@ private:
std::unique_ptr> root = nullptr;
Coord min_x = 0, min_y = 0;
Coord max_x = 0, max_y = 0;
- const size_t kMinIntersections;
- const size_t kMaxDepth;
+ const size_t k_min_intersections;
+ const size_t k_max_depth;
const std::vector & polygons;
@@ -236,7 +236,7 @@ private:
}
#endif
size_t intersections = possible_ids.size() - covered;
- if (intersections <= kMinIntersections || depth++ == kMaxDepth)
+ if (intersections <= k_min_intersections || depth++ == k_max_depth)
return std::make_unique(possible_ids, polygons, current_box, covered);
auto x_shift = (current_max_x - current_min_x) / DividedCell::kSplit;
auto y_shift = (current_max_y - current_min_y) / DividedCell::kSplit;
diff --git a/src/Disks/DiskMemory.h b/src/Disks/DiskMemory.h
index eef7b78502d..fe108f53c68 100644
--- a/src/Disks/DiskMemory.h
+++ b/src/Disks/DiskMemory.h
@@ -22,7 +22,7 @@ class WriteBufferFromFileBase;
class DiskMemory : public IDisk
{
public:
- DiskMemory(const String & name_) : name(name_), disk_path("memory://" + name_ + '/') {}
+ explicit DiskMemory(const String & name_) : name(name_), disk_path("memory://" + name_ + '/') {}
const String & getName() const override { return name; }
@@ -97,7 +97,6 @@ private:
void createDirectoriesImpl(const String & path);
void replaceFileImpl(const String & from_path, const String & to_path);
-private:
friend class WriteIndirectBuffer;
enum class FileType
@@ -112,7 +111,7 @@ private:
String data;
FileData(FileType type_, String data_) : type(type_), data(std::move(data_)) {}
- explicit FileData(FileType type_) : type(type_), data("") {}
+ explicit FileData(FileType type_) : type(type_) {}
};
using Files = std::unordered_map; /// file path -> file data
diff --git a/src/Disks/DiskSelector.h b/src/Disks/DiskSelector.h
index 0cd1267c6ef..a2fce4b14d1 100644
--- a/src/Disks/DiskSelector.h
+++ b/src/Disks/DiskSelector.h
@@ -19,7 +19,7 @@ class DiskSelector
{
public:
DiskSelector(const Poco::Util::AbstractConfiguration & config, const String & config_prefix, ContextPtr context);
- DiskSelector(const DiskSelector & from) : disks(from.disks) { }
+ DiskSelector(const DiskSelector & from) = default;
DiskSelectorPtr updateFromConfig(
const Poco::Util::AbstractConfiguration & config,
diff --git a/src/Disks/DiskWebServer.h b/src/Disks/DiskWebServer.h
index bda8c8adaad..e2da0b2a1e1 100644
--- a/src/Disks/DiskWebServer.h
+++ b/src/Disks/DiskWebServer.h
@@ -38,7 +38,7 @@ namespace ErrorCodes
*
* To get files for upload run:
* clickhouse static-files-disk-uploader --metadata-path --output-dir
- * (--metadata-path can be found in query: `select data_paths from system.tables where name='';`)
+ * (--metadata-path can be found in query: `select data_paths from system.tables where name='';`) /// NOLINT
*
* When loading files by they must be loaded into /store/ path, but config must conrain only .
*
diff --git a/src/Disks/IDisk.h b/src/Disks/IDisk.h
index 5068ac5dde9..d7d94cd03d7 100644
--- a/src/Disks/IDisk.h
+++ b/src/Disks/IDisk.h
@@ -158,14 +158,14 @@ public:
virtual void listFiles(const String & path, std::vector & file_names) = 0;
/// Open the file for read and return ReadBufferFromFileBase object.
- virtual std::unique_ptr readFile(
+ virtual std::unique_ptr readFile( /// NOLINT
const String & path,
const ReadSettings & settings = ReadSettings{},
std::optional read_hint = {},
std::optional file_size = {}) const = 0;
/// Open the file for write and return WriteBufferFromFileBase object.
- virtual std::unique_ptr writeFile(
+ virtual std::unique_ptr writeFile( /// NOLINT
const String & path,
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
WriteMode mode = WriteMode::Rewrite) = 0;
@@ -354,7 +354,7 @@ public:
virtual UInt64 getSize() const = 0;
/// Get i-th disk where reservation take place.
- virtual DiskPtr getDisk(size_t i = 0) const = 0;
+ virtual DiskPtr getDisk(size_t i = 0) const = 0; /// NOLINT
/// Get all disks, used in reservation
virtual Disks getDisks() const = 0;
diff --git a/src/Disks/IDiskRemote.h b/src/Disks/IDiskRemote.h
index 1d8da1aab14..82e76b8f68d 100644
--- a/src/Disks/IDiskRemote.h
+++ b/src/Disks/IDiskRemote.h
@@ -13,7 +13,6 @@
#include
#include
-namespace fs = std::filesystem;
namespace CurrentMetrics
{
@@ -28,7 +27,7 @@ namespace DB
class RemoteFSPathKeeper
{
public:
- RemoteFSPathKeeper(size_t chunk_limit_) : chunk_limit(chunk_limit_) {}
+ explicit RemoteFSPathKeeper(size_t chunk_limit_) : chunk_limit(chunk_limit_) {}
virtual ~RemoteFSPathKeeper() = default;
diff --git a/src/Disks/LocalDirectorySyncGuard.h b/src/Disks/LocalDirectorySyncGuard.h
index 34e4cb9e657..cb891461e85 100644
--- a/src/Disks/LocalDirectorySyncGuard.h
+++ b/src/Disks/LocalDirectorySyncGuard.h
@@ -17,8 +17,8 @@ class LocalDirectorySyncGuard final : public ISyncGuard
public:
/// NOTE: If you have already opened descriptor, it's preferred to use
/// this constructor instead of constructor with path.
- LocalDirectorySyncGuard(int fd_) : fd(fd_) {}
- LocalDirectorySyncGuard(const String & full_path);
+ explicit LocalDirectorySyncGuard(int fd_) : fd(fd_) {}
+ explicit LocalDirectorySyncGuard(const String & full_path);
~LocalDirectorySyncGuard() override;
private:
diff --git a/src/Disks/TemporaryFileOnDisk.h b/src/Disks/TemporaryFileOnDisk.h
index c854a600146..b82cb7d2254 100644
--- a/src/Disks/TemporaryFileOnDisk.h
+++ b/src/Disks/TemporaryFileOnDisk.h
@@ -15,7 +15,7 @@ using DiskPtr = std::shared_ptr;
class TemporaryFileOnDisk
{
public:
- TemporaryFileOnDisk(const DiskPtr & disk_, const String & prefix_ = "tmp");
+ explicit TemporaryFileOnDisk(const DiskPtr & disk_, const String & prefix_ = "tmp");
~TemporaryFileOnDisk();
DiskPtr getDisk() const { return disk; }
diff --git a/src/Formats/CapnProtoUtils.h b/src/Formats/CapnProtoUtils.h
index 51c152de17f..47fe3ada7cd 100644
--- a/src/Formats/CapnProtoUtils.h
+++ b/src/Formats/CapnProtoUtils.h
@@ -18,14 +18,14 @@ struct DestructorCatcher
{
T impl;
template
- DestructorCatcher(Arg && ... args) : impl(kj::fwd(args)...) {}
+ explicit DestructorCatcher(Arg && ... args) : impl(kj::fwd(args)...) {}
~DestructorCatcher() noexcept try { } catch (...) { return; }
};
class CapnProtoSchemaParser : public DestructorCatcher
{
public:
- CapnProtoSchemaParser() {}
+ CapnProtoSchemaParser() = default;
capnp::StructSchema getMessageSchema(const FormatSchemaInfo & schema_info);
};
diff --git a/src/Formats/JSONEachRowUtils.h b/src/Formats/JSONEachRowUtils.h
index 6f71baa8b40..8d304e2ffd8 100644
--- a/src/Formats/JSONEachRowUtils.h
+++ b/src/Formats/JSONEachRowUtils.h
@@ -1,5 +1,7 @@
#pragma once
+#include
+#include
#include
#include
#include
diff --git a/src/Formats/MarkInCompressedFile.h b/src/Formats/MarkInCompressedFile.h
index ceefde43615..1cd545e1a03 100644
--- a/src/Formats/MarkInCompressedFile.h
+++ b/src/Formats/MarkInCompressedFile.h
@@ -33,7 +33,7 @@ struct MarkInCompressedFile
return "(" + DB::toString(offset_in_compressed_file) + "," + DB::toString(offset_in_decompressed_block) + ")";
}
- String toStringWithRows(size_t rows_num)
+ String toStringWithRows(size_t rows_num) const
{
return "(" + DB::toString(offset_in_compressed_file) + "," + DB::toString(offset_in_decompressed_block) + "," + DB::toString(rows_num) + ")";
}
@@ -43,7 +43,7 @@ struct MarkInCompressedFile
class MarksInCompressedFile : public PODArray
{
public:
- MarksInCompressedFile(size_t n) : PODArray(n) {}
+ explicit MarksInCompressedFile(size_t n) : PODArray(n) {}
void read(ReadBuffer & buffer, size_t from, size_t count)
{
diff --git a/src/Formats/ParsedTemplateFormatString.h b/src/Formats/ParsedTemplateFormatString.h
index c5617d0f0ef..5d7ee820f2f 100644
--- a/src/Formats/ParsedTemplateFormatString.h
+++ b/src/Formats/ParsedTemplateFormatString.h
@@ -28,7 +28,7 @@ struct ParsedTemplateFormatString
/// For diagnostic info
Strings column_names;
- typedef std::function(const String &)> ColumnIdxGetter;
+ using ColumnIdxGetter = std::function(const String &)>;
ParsedTemplateFormatString() = default;
ParsedTemplateFormatString(const FormatSchemaInfo & schema, const ColumnIdxGetter & idx_by_name, bool allow_indexes = true);
diff --git a/src/Formats/ProtobufReader.h b/src/Formats/ProtobufReader.h
index 0df139eeacd..2e2a71a7d11 100644
--- a/src/Formats/ProtobufReader.h
+++ b/src/Formats/ProtobufReader.h
@@ -16,7 +16,7 @@ class ReadBuffer;
class ProtobufReader
{
public:
- ProtobufReader(ReadBuffer & in_);
+ explicit ProtobufReader(ReadBuffer & in_);
void startMessage(bool with_length_delimiter_);
void endMessage(bool ignore_errors);
diff --git a/src/Formats/ProtobufWriter.h b/src/Formats/ProtobufWriter.h
index c564db110cc..1dcc8f4ef7c 100644
--- a/src/Formats/ProtobufWriter.h
+++ b/src/Formats/ProtobufWriter.h
@@ -16,7 +16,7 @@ class WriteBuffer;
class ProtobufWriter
{
public:
- ProtobufWriter(WriteBuffer & out_);
+ explicit ProtobufWriter(WriteBuffer & out_);
~ProtobufWriter();
void startMessage();
diff --git a/src/Formats/RowInputMissingColumnsFiller.h b/src/Formats/RowInputMissingColumnsFiller.h
index 0eaefd4e814..9785d8bed62 100644
--- a/src/Formats/RowInputMissingColumnsFiller.h
+++ b/src/Formats/RowInputMissingColumnsFiller.h
@@ -14,7 +14,7 @@ class RowInputMissingColumnsFiller
{
public:
/// Makes a column filler which checks nested structures while adding default values to columns.
- RowInputMissingColumnsFiller(const NamesAndTypesList & names_and_types);
+ explicit RowInputMissingColumnsFiller(const NamesAndTypesList & names_and_types);
RowInputMissingColumnsFiller(const Names & names, const DataTypes & types);
RowInputMissingColumnsFiller(size_t count, const std::string_view * names, const DataTypePtr * types);
diff --git a/src/Functions/CountSubstringsImpl.h b/src/Functions/CountSubstringsImpl.h
index 6668ca0a392..fc6e4a0e671 100644
--- a/src/Functions/CountSubstringsImpl.h
+++ b/src/Functions/CountSubstringsImpl.h
@@ -83,7 +83,7 @@ struct CountSubstringsImpl
{
res = 0;
- if (needle.size() == 0)
+ if (needle.empty())
return;
auto start = std::max(start_pos, UInt64(1));
diff --git a/src/Functions/DivisionUtils.h b/src/Functions/DivisionUtils.h
index 2e601888ecc..c246f7fd31a 100644
--- a/src/Functions/DivisionUtils.h
+++ b/src/Functions/DivisionUtils.h
@@ -6,6 +6,7 @@
#include
#include
+#include "config_core.h"
#include
diff --git a/src/Functions/DummyJSONParser.h b/src/Functions/DummyJSONParser.h
index c14aacece86..77b958d1429 100644
--- a/src/Functions/DummyJSONParser.h
+++ b/src/Functions/DummyJSONParser.h
@@ -2,6 +2,8 @@
#include
#include
+#include
+
namespace DB
{
@@ -22,25 +24,25 @@ struct DummyJSONParser
class Element
{
public:
- Element() {}
- bool isInt64() const { return false; }
- bool isUInt64() const { return false; }
- bool isDouble() const { return false; }
- bool isString() const { return false; }
- bool isArray() const { return false; }
- bool isObject() const { return false; }
- bool isBool() const { return false; }
- bool isNull() const { return false; }
+ Element() = default;
+ static bool isInt64() { return false; }
+ static bool isUInt64() { return false; }
+ static bool isDouble() { return false; }
+ static bool isString() { return false; }
+ static bool isArray() { return false; }
+ static bool isObject() { return false; }
+ static bool isBool() { return false; }
+ static bool isNull() { return false; }
- Int64 getInt64() const { return 0; }
- UInt64 getUInt64() const { return 0; }
- double getDouble() const { return 0; }
- bool getBool() const { return false; }
- std::string_view getString() const { return {}; }
- Array getArray() const { return {}; }
- Object getObject() const { return {}; }
+ static Int64 getInt64() { return 0; }
+ static UInt64 getUInt64() { return 0; }
+ static double getDouble() { return 0; }
+ static bool getBool() { return false; }
+ static std::string_view getString() { return {}; }
+ static Array getArray() { return {}; }
+ static Object getObject() { return {}; }
- Element getElement() { return {}; }
+ static Element getElement() { return {}; }
};
/// References an array in a JSON document.
@@ -52,14 +54,14 @@ struct DummyJSONParser
public:
Element operator*() const { return {}; }
Iterator & operator++() { return *this; }
- Iterator operator++(int) { return *this; }
+ Iterator operator++(int) { return *this; } /// NOLINT
friend bool operator==(const Iterator &, const Iterator &) { return true; }
friend bool operator!=(const Iterator &, const Iterator &) { return false; }
};
- Iterator begin() const { return {}; }
- Iterator end() const { return {}; }
- size_t size() const { return 0; }
+ static Iterator begin() { return {}; }
+ static Iterator end() { return {}; }
+ static size_t size() { return 0; }
Element operator[](size_t) const { return {}; }
};
@@ -74,15 +76,15 @@ struct DummyJSONParser
public:
KeyValuePair operator*() const { return {}; }
Iterator & operator++() { return *this; }
- Iterator operator++(int) { return *this; }
+ Iterator operator++(int) { return *this; } /// NOLINT
friend bool operator==(const Iterator &, const Iterator &) { return true; }
friend bool operator!=(const Iterator &, const Iterator &) { return false; }
};
- Iterator begin() const { return {}; }
- Iterator end() const { return {}; }
- size_t size() const { return 0; }
- bool find(const std::string_view &, Element &) const { return false; }
+ static Iterator begin() { return {}; }
+ static Iterator end() { return {}; }
+ static size_t size() { return 0; }
+ bool find(const std::string_view &, Element &) const { return false; } /// NOLINT
#if 0
/// Optional: Provides access to an object's element by index.
@@ -91,7 +93,7 @@ struct DummyJSONParser
};
/// Parses a JSON document, returns the reference to its root element if succeeded.
- bool parse(const std::string_view &, Element &) { throw Exception{"Functions JSON* are not supported", ErrorCodes::NOT_IMPLEMENTED}; }
+ bool parse(const std::string_view &, Element &) { throw Exception{"Functions JSON* are not supported", ErrorCodes::NOT_IMPLEMENTED}; } /// NOLINT
#if 0
/// Optional: Allocates memory to parse JSON documents faster.
diff --git a/src/Functions/EmptyImpl.h b/src/Functions/EmptyImpl.h
index 60daa66ea03..6f5c4f7a7dc 100644
--- a/src/Functions/EmptyImpl.h
+++ b/src/Functions/EmptyImpl.h
@@ -2,6 +2,7 @@
#include
#include
+#include
#include
diff --git a/src/Functions/FunctionBitTestMany.h b/src/Functions/FunctionBitTestMany.h
index 808c3711631..e49af4c166f 100644
--- a/src/Functions/FunctionBitTestMany.h
+++ b/src/Functions/FunctionBitTestMany.h
@@ -5,6 +5,7 @@
#include
#include
#include
+#include
#include
diff --git a/src/Functions/FunctionCustomWeekToSomething.h b/src/Functions/FunctionCustomWeekToSomething.h
index 542062151ce..6ed751fd889 100644
--- a/src/Functions/FunctionCustomWeekToSomething.h
+++ b/src/Functions/FunctionCustomWeekToSomething.h
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
namespace DB
diff --git a/src/Functions/FunctionSQLJSON.h b/src/Functions/FunctionSQLJSON.h
index d860da62b9d..56d29e0c776 100644
--- a/src/Functions/FunctionSQLJSON.h
+++ b/src/Functions/FunctionSQLJSON.h
@@ -242,7 +242,7 @@ public:
GeneratorJSONPath generator_json_path(query_ptr);
Element current_element = root;
VisitorStatus status;
- Element res;
+
while ((status = generator_json_path.getNextItem(current_element)) != VisitorStatus::Exhausted)
{
if (status == VisitorStatus::Ok)
diff --git a/src/Functions/FunctionSnowflake.h b/src/Functions/FunctionSnowflake.h
index 1ba15433e94..f4a62e509ed 100644
--- a/src/Functions/FunctionSnowflake.h
+++ b/src/Functions/FunctionSnowflake.h
@@ -24,7 +24,7 @@ namespace ErrorCodes
* https://blog.twitter.com/engineering/en_us/a/2010/announcing-snowflake
* https://ws-dl.blogspot.com/2019/08/2019-08-03-tweetedat-finding-tweet.html
*/
-static constexpr long snowflake_epoch = 1288834974657L;
+static constexpr size_t snowflake_epoch = 1288834974657L;
static constexpr int time_shift = 22;
class FunctionDateTimeToSnowflake : public IFunction
@@ -33,7 +33,7 @@ private:
const char * name;
public:
- FunctionDateTimeToSnowflake(const char * name_) : name(name_) { }
+ explicit FunctionDateTimeToSnowflake(const char * name_) : name(name_) { }
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 1; }
@@ -74,7 +74,7 @@ private:
const char * name;
public:
- FunctionSnowflakeToDateTime(const char * name_) : name(name_) { }
+ explicit FunctionSnowflakeToDateTime(const char * name_) : name(name_) { }
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 0; }
@@ -84,7 +84,7 @@ public:
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
{
- if (arguments.size() < 1 || arguments.size() > 2)
+ if (arguments.empty() || arguments.size() > 2)
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Function {} takes one or two arguments", name);
if (!typeid_cast(arguments[0].type.get()))
@@ -122,7 +122,7 @@ private:
const char * name;
public:
- FunctionDateTime64ToSnowflake(const char * name_) : name(name_) { }
+ explicit FunctionDateTime64ToSnowflake(const char * name_) : name(name_) { }
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 1; }
@@ -163,7 +163,7 @@ private:
const char * name;
public:
- FunctionSnowflakeToDateTime64(const char * name_) : name(name_) { }
+ explicit FunctionSnowflakeToDateTime64(const char * name_) : name(name_) { }
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 0; }
@@ -173,7 +173,7 @@ public:
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
{
- if (arguments.size() < 1 || arguments.size() > 2)
+ if (arguments.empty() || arguments.size() > 2)
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Function {} takes one or two arguments", name);
if (!typeid_cast(arguments[0].type.get()))
diff --git a/src/Functions/FunctionStringOrArrayToT.h b/src/Functions/FunctionStringOrArrayToT.h
index 3bf1f0a5d34..cda5da5c177 100644
--- a/src/Functions/FunctionStringOrArrayToT.h
+++ b/src/Functions/FunctionStringOrArrayToT.h
@@ -9,6 +9,7 @@
#include
#include
#include
+#include
namespace DB
diff --git a/src/Functions/FunctionsBitmap.h b/src/Functions/FunctionsBitmap.h
index 775a39f4d08..1e48588892a 100644
--- a/src/Functions/FunctionsBitmap.h
+++ b/src/Functions/FunctionsBitmap.h
@@ -421,7 +421,7 @@ private:
for (size_t i = 0; i < input_rows_count; ++i)
{
- const AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
+ AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
const AggregateFunctionGroupBitmapData & bitmap_data_0
= *reinterpret_cast*>(data_ptr_0);
const UInt64 range_start = is_column_const[1] ? (*container1)[0] : (*container1)[i];
@@ -615,7 +615,7 @@ private:
size_t to_end;
for (size_t i = 0; i < input_rows_count; ++i)
{
- const AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
+ AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
const AggregateFunctionGroupBitmapData & bitmap_data_0
= *reinterpret_cast *>(data_ptr_0);
if (is_column_const[1])
@@ -923,7 +923,7 @@ private:
for (size_t i = 0; i < input_rows_count; ++i)
{
- const AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
+ AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
const UInt64 data1 = is_column_const[1] ? (*container1)[0] : (*container1)[i];
const AggregateFunctionGroupBitmapData & bitmap_data_0
= *reinterpret_cast *>(data_ptr_0);
@@ -1030,8 +1030,8 @@ private:
for (size_t i = 0; i < input_rows_count; ++i)
{
- const AggregateDataPtr data_ptr_0 = is_column_const[0] ? container0[0] : container0[i];
- const AggregateDataPtr data_ptr_1 = is_column_const[1] ? container1[0] : container1[i];
+ AggregateDataPtr data_ptr_0 = is_column_const[0] ? container0[0] : container0[i];
+ AggregateDataPtr data_ptr_1 = is_column_const[1] ? container1[0] : container1[i];
const AggregateFunctionGroupBitmapData & bitmap_data_1
= *reinterpret_cast *>(data_ptr_0);
const AggregateFunctionGroupBitmapData & bitmap_data_2
@@ -1178,8 +1178,8 @@ private:
for (size_t i = 0; i < input_rows_count; ++i)
{
- const AggregateDataPtr data_ptr_0 = is_column_const[0] ? container0[0] : container0[i];
- const AggregateDataPtr data_ptr_1 = is_column_const[1] ? container1[0] : container1[i];
+ AggregateDataPtr data_ptr_0 = is_column_const[0] ? container0[0] : container0[i];
+ AggregateDataPtr data_ptr_1 = is_column_const[1] ? container1[0] : container1[i];
// bitmapAnd(RoaringBitMap, SmallSet) is slower than bitmapAnd(SmallSet, RoaringBitMap), so we can exchange the position of two arguments for the speed
auto * bm_1 = reinterpret_cast *>(data_ptr_0);
diff --git a/src/Functions/FunctionsComparison.h b/src/Functions/FunctionsComparison.h
index a0c7fc643d2..0d0195eb2d7 100644
--- a/src/Functions/FunctionsComparison.h
+++ b/src/Functions/FunctionsComparison.h
@@ -137,7 +137,7 @@ struct NumComparisonImpl
template
struct StringComparisonImpl
{
- static void NO_INLINE string_vector_string_vector(
+ static void NO_INLINE string_vector_string_vector( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray & c)
@@ -157,7 +157,7 @@ struct StringComparisonImpl
}
}
- static void NO_INLINE string_vector_fixed_string_vector(
+ static void NO_INLINE string_vector_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray & c)
@@ -175,7 +175,7 @@ struct StringComparisonImpl
}
}
- static void NO_INLINE string_vector_constant(
+ static void NO_INLINE string_vector_constant( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, ColumnString::Offset b_size,
PaddedPODArray & c)
@@ -193,7 +193,7 @@ struct StringComparisonImpl
}
}
- static void fixed_string_vector_string_vector(
+ static void fixed_string_vector_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray & c)
@@ -201,7 +201,7 @@ struct StringComparisonImpl
StringComparisonImpl::string_vector_fixed_string_vector(b_data, b_offsets, a_data, a_n, c);
}
- static void NO_INLINE fixed_string_vector_fixed_string_vector_16(
+ static void NO_INLINE fixed_string_vector_fixed_string_vector_16( /// NOLINT
const ColumnString::Chars & a_data,
const ColumnString::Chars & b_data,
PaddedPODArray & c)
@@ -212,7 +212,7 @@ struct StringComparisonImpl
c[j] = Op::apply(memcmp16(&a_data[i], &b_data[i]), 0);
}
- static void NO_INLINE fixed_string_vector_constant_16(
+ static void NO_INLINE fixed_string_vector_constant_16( /// NOLINT
const ColumnString::Chars & a_data,
const ColumnString::Chars & b_data,
PaddedPODArray & c)
@@ -223,7 +223,7 @@ struct StringComparisonImpl
c[j] = Op::apply(memcmp16(&a_data[i], &b_data[0]), 0);
}
- static void NO_INLINE fixed_string_vector_fixed_string_vector(
+ static void NO_INLINE fixed_string_vector_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray & c)
@@ -250,7 +250,7 @@ struct StringComparisonImpl
}
}
- static void NO_INLINE fixed_string_vector_constant(
+ static void NO_INLINE fixed_string_vector_constant( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, ColumnString::Offset b_size,
PaddedPODArray & c)
@@ -273,7 +273,7 @@ struct StringComparisonImpl
}
}
- static void constant_string_vector(
+ static void constant_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_size,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray & c)
@@ -281,7 +281,7 @@ struct StringComparisonImpl
StringComparisonImpl::string_vector_constant(b_data, b_offsets, a_data, a_size, c);
}
- static void constant_fixed_string_vector(
+ static void constant_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_size,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray & c)
@@ -295,7 +295,7 @@ struct StringComparisonImpl
template
struct StringEqualsImpl
{
- static void NO_INLINE string_vector_string_vector(
+ static void NO_INLINE string_vector_string_vector( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray & c)
@@ -318,7 +318,7 @@ struct StringEqualsImpl
}
}
- static void NO_INLINE string_vector_fixed_string_vector(
+ static void NO_INLINE string_vector_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray & c)
@@ -338,7 +338,7 @@ struct StringEqualsImpl
}
}
- static void NO_INLINE string_vector_constant(
+ static void NO_INLINE string_vector_constant( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, ColumnString::Offset b_size,
PaddedPODArray & c)
@@ -358,7 +358,7 @@ struct StringEqualsImpl
}
}
- static void NO_INLINE fixed_string_vector_fixed_string_vector_16(
+ static void NO_INLINE fixed_string_vector_fixed_string_vector_16( /// NOLINT
const ColumnString::Chars & a_data,
const ColumnString::Chars & b_data,
PaddedPODArray & c)
@@ -371,7 +371,7 @@ struct StringEqualsImpl
b_data.data() + i * 16);
}
- static void NO_INLINE fixed_string_vector_constant_16(
+ static void NO_INLINE fixed_string_vector_constant_16( /// NOLINT
const ColumnString::Chars & a_data,
const ColumnString::Chars & b_data,
PaddedPODArray & c)
@@ -384,7 +384,7 @@ struct StringEqualsImpl
b_data.data());
}
- static void NO_INLINE fixed_string_vector_fixed_string_vector(
+ static void NO_INLINE fixed_string_vector_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray & c)
@@ -410,7 +410,7 @@ struct StringEqualsImpl
}
}
- static void NO_INLINE fixed_string_vector_constant(
+ static void NO_INLINE fixed_string_vector_constant( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, ColumnString::Offset b_size,
PaddedPODArray & c)
@@ -427,7 +427,7 @@ struct StringEqualsImpl
}
}
- static void fixed_string_vector_string_vector(
+ static void fixed_string_vector_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray & c)
@@ -435,7 +435,7 @@ struct StringEqualsImpl
string_vector_fixed_string_vector(b_data, b_offsets, a_data, a_n, c);
}
- static void constant_string_vector(
+ static void constant_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_size,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray & c)
@@ -443,7 +443,7 @@ struct StringEqualsImpl
string_vector_constant(b_data, b_offsets, a_data, a_size, c);
}
- static void constant_fixed_string_vector(
+ static void constant_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_size,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray & c)
diff --git a/src/Functions/FunctionsConversion.h b/src/Functions/FunctionsConversion.h
index f75d67032f2..5e11cab7e79 100644
--- a/src/Functions/FunctionsConversion.h
+++ b/src/Functions/FunctionsConversion.h
@@ -542,7 +542,7 @@ struct ToDateTime64TransformUnsigned
const DateTime64::NativeType scale_multiplier = 1;
- ToDateTime64TransformUnsigned(UInt32 scale = 0)
+ ToDateTime64TransformUnsigned(UInt32 scale = 0) /// NOLINT
: scale_multiplier(DecimalUtils::scaleMultiplier(scale))
{}
@@ -559,7 +559,7 @@ struct ToDateTime64TransformSigned
const DateTime64::NativeType scale_multiplier = 1;
- ToDateTime64TransformSigned(UInt32 scale = 0)
+ ToDateTime64TransformSigned(UInt32 scale = 0) /// NOLINT
: scale_multiplier(DecimalUtils::scaleMultiplier(scale))
{}
@@ -577,7 +577,7 @@ struct ToDateTime64TransformFloat
const UInt32 scale = 1;
- ToDateTime64TransformFloat(UInt32 scale_ = 0)
+ ToDateTime64TransformFloat(UInt32 scale_ = 0) /// NOLINT
: scale(scale_)
{}
@@ -615,7 +615,7 @@ struct FromDateTime64Transform
const DateTime64::NativeType scale_multiplier = 1;
- FromDateTime64Transform(UInt32 scale)
+ FromDateTime64Transform(UInt32 scale) /// NOLINT
: scale_multiplier(DecimalUtils::scaleMultiplier(scale))
{}
@@ -639,7 +639,7 @@ struct ToDateTime64Transform
const DateTime64::NativeType scale_multiplier = 1;
- ToDateTime64Transform(UInt32 scale = 0)
+ ToDateTime64Transform(UInt32 scale = 0) /// NOLINT
: scale_multiplier(DecimalUtils::scaleMultiplier(scale))
{}
diff --git a/src/Functions/FunctionsExternalDictionaries.h b/src/Functions/FunctionsExternalDictionaries.h
index 7e26de574aa..6a701d7b864 100644
--- a/src/Functions/FunctionsExternalDictionaries.h
+++ b/src/Functions/FunctionsExternalDictionaries.h
@@ -897,7 +897,9 @@ private:
result = std::move(dictionary_get_result_column);
}
else
- result = ColumnNullable::create(std::move(dictionary_get_result_column), std::move(is_key_in_dictionary_column_mutable));
+ {
+ result = ColumnNullable::create(dictionary_get_result_column, std::move(is_key_in_dictionary_column_mutable));
+ }
}
return result;
diff --git a/src/Functions/FunctionsLogical.h b/src/Functions/FunctionsLogical.h
index 7d4f5489e86..140981faf9f 100644
--- a/src/Functions/FunctionsLogical.h
+++ b/src/Functions/FunctionsLogical.h
@@ -7,6 +7,7 @@
#include
#include
#include
+#include
#if USE_EMBEDDED_COMPILER
@@ -147,7 +148,6 @@ public:
static constexpr auto name = Name::name;
static FunctionPtr create(ContextPtr) { return std::make_shared(); }
-public:
String getName() const override
{
return name;
@@ -189,7 +189,7 @@ public:
result = Impl::apply(b, result, nativeBoolCast(b, types[i], values[i]));
return b.CreateSelect(result, b.getInt8(1), b.getInt8(0));
}
- constexpr bool breakOnTrue = Impl::isSaturatedValue(true);
+ constexpr bool break_on_true = Impl::isSaturatedValue(true);
auto * next = b.GetInsertBlock();
auto * stop = llvm::BasicBlock::Create(next->getContext(), "", next->getParent());
b.SetInsertPoint(stop);
@@ -205,7 +205,7 @@ public:
if (i + 1 < types.size())
{
next = llvm::BasicBlock::Create(next->getContext(), "", next->getParent());
- b.CreateCondBr(truth, breakOnTrue ? stop : next, breakOnTrue ? next : stop);
+ b.CreateCondBr(truth, break_on_true ? stop : next, break_on_true ? next : stop);
}
}
b.CreateBr(stop);
@@ -223,7 +223,6 @@ public:
static constexpr auto name = Name::name;
static FunctionPtr create(ContextPtr) { return std::make_shared(); }
-public:
String getName() const override
{
return name;
diff --git a/src/Functions/FunctionsStringArray.h b/src/Functions/FunctionsStringArray.h
index b1de017120c..a1256598f1b 100644
--- a/src/Functions/FunctionsStringArray.h
+++ b/src/Functions/FunctionsStringArray.h
@@ -93,7 +93,7 @@ public:
}
/// Returns the position of the argument, that is the column of strings
- size_t getStringsArgumentPosition()
+ static size_t getStringsArgumentPosition()
{
return 0;
}
@@ -152,7 +152,7 @@ public:
}
/// Returns the position of the argument, that is the column of strings
- size_t getStringsArgumentPosition()
+ static size_t getStringsArgumentPosition()
{
return 0;
}
@@ -211,7 +211,7 @@ public:
}
/// Returns the position of the argument, that is the column of strings
- size_t getStringsArgumentPosition()
+ static size_t getStringsArgumentPosition()
{
return 0;
}
@@ -328,7 +328,7 @@ public:
}
/// Returns the position of the argument, that is the column of strings
- size_t getStringsArgumentPosition()
+ static size_t getStringsArgumentPosition()
{
return 1;
}
@@ -399,7 +399,7 @@ public:
}
/// Returns the position of the argument that is the column of strings
- size_t getStringsArgumentPosition()
+ static size_t getStringsArgumentPosition()
{
return 1;
}
@@ -482,7 +482,7 @@ public:
}
/// Returns the position of the argument that is the column of strings
- size_t getStringsArgumentPosition()
+ static size_t getStringsArgumentPosition()
{
return 1;
}
@@ -567,7 +567,7 @@ public:
}
/// Returns the position of the argument that is the column of strings
- size_t getStringsArgumentPosition()
+ static size_t getStringsArgumentPosition()
{
return 0;
}
diff --git a/src/Functions/GatherUtils/Algorithms.h b/src/Functions/GatherUtils/Algorithms.h
index 2d4544b2167..d08248e71fc 100644
--- a/src/Functions/GatherUtils/Algorithms.h
+++ b/src/Functions/GatherUtils/Algorithms.h
@@ -203,7 +203,7 @@ void concat(const std::vector> & array_sources, Si
size_t sources_num = array_sources.size();
std::vector is_const(sources_num);
- auto checkAndGetSizeToReserve = [] (auto source, IArraySource * array_source)
+ auto check_and_get_size_to_reserve = [] (auto source, IArraySource * array_source)
{
if (source == nullptr)
throw Exception("Concat function expected " + demangle(typeid(Source).name()) + " or "
@@ -215,17 +215,17 @@ void concat(const std::vector> & array_sources, Si
size_t size_to_reserve = 0;
for (auto i : collections::range(0, sources_num))
{
- auto & source = array_sources[i];
+ const auto & source = array_sources[i];
is_const[i] = source->isConst();
if (is_const[i])
- size_to_reserve += checkAndGetSizeToReserve(typeid_cast *>(source.get()), source.get());
+ size_to_reserve += check_and_get_size_to_reserve(typeid_cast *>(source.get()), source.get());
else
- size_to_reserve += checkAndGetSizeToReserve(typeid_cast