mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 18:32:29 +00:00
Merge branch 'master' into fix_wait_for_mutation_done
This commit is contained in:
commit
c90ec72fde
@ -5,9 +5,7 @@
|
|||||||
# a) the new check is not controversial (this includes many checks in readability-* and google-*) or
|
# a) the new check is not controversial (this includes many checks in readability-* and google-*) or
|
||||||
# b) too noisy (checks with > 100 new warnings are considered noisy, this includes e.g. cppcoreguidelines-*).
|
# b) too noisy (checks with > 100 new warnings are considered noisy, this includes e.g. cppcoreguidelines-*).
|
||||||
|
|
||||||
# TODO Let clang-tidy check headers in further directories
|
HeaderFilterRegex: '^.*/(base|src|programs|utils)/.*(h|hpp)$'
|
||||||
# --> HeaderFilterRegex: '^.*/(src|base|programs|utils)/.*(h|hpp)$'
|
|
||||||
HeaderFilterRegex: '^.*/(base|programs|utils)/.*(h|hpp)$'
|
|
||||||
|
|
||||||
Checks: [
|
Checks: [
|
||||||
'*',
|
'*',
|
||||||
@ -22,6 +20,7 @@ Checks: [
|
|||||||
'-bugprone-branch-clone',
|
'-bugprone-branch-clone',
|
||||||
'-bugprone-easily-swappable-parameters',
|
'-bugprone-easily-swappable-parameters',
|
||||||
'-bugprone-exception-escape',
|
'-bugprone-exception-escape',
|
||||||
|
'-bugprone-forward-declaration-namespace',
|
||||||
'-bugprone-implicit-widening-of-multiplication-result',
|
'-bugprone-implicit-widening-of-multiplication-result',
|
||||||
'-bugprone-narrowing-conversions',
|
'-bugprone-narrowing-conversions',
|
||||||
'-bugprone-not-null-terminated-result',
|
'-bugprone-not-null-terminated-result',
|
||||||
@ -37,6 +36,8 @@ Checks: [
|
|||||||
'-cert-oop54-cpp',
|
'-cert-oop54-cpp',
|
||||||
'-cert-oop57-cpp',
|
'-cert-oop57-cpp',
|
||||||
|
|
||||||
|
'-clang-analyzer-optin.performance.Padding',
|
||||||
|
|
||||||
'-clang-analyzer-unix.Malloc',
|
'-clang-analyzer-unix.Malloc',
|
||||||
|
|
||||||
'-cppcoreguidelines-*', # impractical in a codebase as large as ClickHouse, also slow
|
'-cppcoreguidelines-*', # impractical in a codebase as large as ClickHouse, also slow
|
||||||
|
@ -30,7 +30,6 @@ namespace Net
|
|||||||
|
|
||||||
|
|
||||||
class HTTPServerRequest;
|
class HTTPServerRequest;
|
||||||
class HTTPServerResponse;
|
|
||||||
class HTTPRequestHandler;
|
class HTTPRequestHandler;
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,13 +26,13 @@ const uint8_t MetroHash64::test_seed_1[8] = { 0x3B, 0x0D, 0x48, 0x1C, 0xF4, 0x
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
MetroHash64::MetroHash64(const uint64_t seed)
|
MetroHash64::MetroHash64(uint64_t seed)
|
||||||
{
|
{
|
||||||
Initialize(seed);
|
Initialize(seed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MetroHash64::Initialize(const uint64_t seed)
|
void MetroHash64::Initialize(uint64_t seed)
|
||||||
{
|
{
|
||||||
vseed = (static_cast<uint64_t>(seed) + k2) * k0;
|
vseed = (static_cast<uint64_t>(seed) + k2) * k0;
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ void MetroHash64::Initialize(const uint64_t seed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MetroHash64::Update(const uint8_t * const buffer, const uint64_t length)
|
void MetroHash64::Update(const uint8_t * const buffer, uint64_t length)
|
||||||
{
|
{
|
||||||
const uint8_t * ptr = reinterpret_cast<const uint8_t*>(buffer);
|
const uint8_t * ptr = reinterpret_cast<const uint8_t*>(buffer);
|
||||||
const uint8_t * const end = ptr + length;
|
const uint8_t * const end = ptr + length;
|
||||||
@ -90,7 +90,7 @@ void MetroHash64::Update(const uint8_t * const buffer, const uint64_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MetroHash64::Finalize(uint8_t * const hash)
|
void MetroHash64::Finalize(uint8_t * hash)
|
||||||
{
|
{
|
||||||
// finalize bulk loop, if used
|
// finalize bulk loop, if used
|
||||||
if (bytes >= 32)
|
if (bytes >= 32)
|
||||||
@ -152,7 +152,7 @@ void MetroHash64::Finalize(uint8_t * const hash)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MetroHash64::Hash(const uint8_t * buffer, const uint64_t length, uint8_t * const hash, const uint64_t seed)
|
void MetroHash64::Hash(const uint8_t * buffer, uint64_t length, uint8_t * const hash, uint64_t seed)
|
||||||
{
|
{
|
||||||
const uint8_t * ptr = reinterpret_cast<const uint8_t*>(buffer);
|
const uint8_t * ptr = reinterpret_cast<const uint8_t*>(buffer);
|
||||||
const uint8_t * const end = ptr + length;
|
const uint8_t * const end = ptr + length;
|
||||||
|
@ -25,24 +25,24 @@ public:
|
|||||||
static const uint32_t bits = 64;
|
static const uint32_t bits = 64;
|
||||||
|
|
||||||
// Constructor initializes the same as Initialize()
|
// Constructor initializes the same as Initialize()
|
||||||
explicit MetroHash64(const uint64_t seed=0);
|
explicit MetroHash64(uint64_t seed=0);
|
||||||
|
|
||||||
// Initializes internal state for new hash with optional seed
|
// Initializes internal state for new hash with optional seed
|
||||||
void Initialize(const uint64_t seed=0);
|
void Initialize(uint64_t seed=0);
|
||||||
|
|
||||||
// Update the hash state with a string of bytes. If the length
|
// Update the hash state with a string of bytes. If the length
|
||||||
// is sufficiently long, the implementation switches to a bulk
|
// is sufficiently long, the implementation switches to a bulk
|
||||||
// hashing algorithm directly on the argument buffer for speed.
|
// hashing algorithm directly on the argument buffer for speed.
|
||||||
void Update(const uint8_t * buffer, const uint64_t length);
|
void Update(const uint8_t * buffer, uint64_t length);
|
||||||
|
|
||||||
// Constructs the final hash and writes it to the argument buffer.
|
// Constructs the final hash and writes it to the argument buffer.
|
||||||
// After a hash is finalized, this instance must be Initialized()-ed
|
// After a hash is finalized, this instance must be Initialized()-ed
|
||||||
// again or the behavior of Update() and Finalize() is undefined.
|
// again or the behavior of Update() and Finalize() is undefined.
|
||||||
void Finalize(uint8_t * const hash);
|
void Finalize(uint8_t * hash);
|
||||||
|
|
||||||
// A non-incremental function implementation. This can be significantly
|
// A non-incremental function implementation. This can be significantly
|
||||||
// faster than the incremental implementation for some usage patterns.
|
// faster than the incremental implementation for some usage patterns.
|
||||||
static void Hash(const uint8_t * buffer, const uint64_t length, uint8_t * const hash, const uint64_t seed=0);
|
static void Hash(const uint8_t * buffer, uint64_t length, uint8_t * hash, uint64_t seed=0);
|
||||||
|
|
||||||
// Does implementation correctly execute test vectors?
|
// Does implementation correctly execute test vectors?
|
||||||
static bool ImplementationVerified();
|
static bool ImplementationVerified();
|
||||||
|
@ -61,6 +61,18 @@ if [[ -n "$BUGFIX_VALIDATE_CHECK" ]] && [[ "$BUGFIX_VALIDATE_CHECK" -eq 1 ]]; th
|
|||||||
rm /etc/clickhouse-server/users.d/s3_cache_new.xml
|
rm /etc/clickhouse-server/users.d/s3_cache_new.xml
|
||||||
rm /etc/clickhouse-server/config.d/zero_copy_destructive_operations.xml
|
rm /etc/clickhouse-server/config.d/zero_copy_destructive_operations.xml
|
||||||
|
|
||||||
|
#todo: remove these after 24.3 released.
|
||||||
|
sudo cat /etc/clickhouse-server/config.d/azure_storage_conf.xml \
|
||||||
|
| sed "s|<object_storage_type>azure|<object_storage_type>azure_blob_storage|" \
|
||||||
|
> /etc/clickhouse-server/config.d/azure_storage_conf.xml.tmp
|
||||||
|
sudo mv /etc/clickhouse-server/config.d/azure_storage_conf.xml.tmp /etc/clickhouse-server/config.d/azure_storage_conf.xml
|
||||||
|
|
||||||
|
#todo: remove these after 24.3 released.
|
||||||
|
sudo cat /etc/clickhouse-server/config.d/storage_conf.xml \
|
||||||
|
| sed "s|<object_storage_type>local|<object_storage_type>local_blob_storage|" \
|
||||||
|
> /etc/clickhouse-server/config.d/storage_conf.xml.tmp
|
||||||
|
sudo mv /etc/clickhouse-server/config.d/storage_conf.xml.tmp /etc/clickhouse-server/config.d/storage_conf.xml
|
||||||
|
|
||||||
function remove_keeper_config()
|
function remove_keeper_config()
|
||||||
{
|
{
|
||||||
sudo cat /etc/clickhouse-server/config.d/keeper_port.xml \
|
sudo cat /etc/clickhouse-server/config.d/keeper_port.xml \
|
||||||
|
@ -297,7 +297,7 @@ namespace
|
|||||||
|
|
||||||
|
|
||||||
std::pair<String, BackupEntryPtr> makeBackupEntryForAccess(
|
std::pair<String, BackupEntryPtr> makeBackupEntryForAccess(
|
||||||
const std::vector<std::pair<UUID, AccessEntityPtr>> access_entities,
|
const std::vector<std::pair<UUID, AccessEntityPtr>> & access_entities,
|
||||||
const String & data_path_in_backup,
|
const String & data_path_in_backup,
|
||||||
size_t counter,
|
size_t counter,
|
||||||
const AccessControl & access_control)
|
const AccessControl & access_control)
|
||||||
@ -326,7 +326,7 @@ void AccessRestorerFromBackup::addDataPath(const String & data_path)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
fs::path data_path_in_backup_fs = data_path;
|
fs::path data_path_in_backup_fs = data_path;
|
||||||
Strings filenames = backup->listFiles(data_path);
|
Strings filenames = backup->listFiles(data_path, /*recursive*/ false);
|
||||||
if (filenames.empty())
|
if (filenames.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ struct RestoreSettings;
|
|||||||
|
|
||||||
/// Makes a backup of access entities of a specified type.
|
/// Makes a backup of access entities of a specified type.
|
||||||
std::pair<String, BackupEntryPtr> makeBackupEntryForAccess(
|
std::pair<String, BackupEntryPtr> makeBackupEntryForAccess(
|
||||||
const std::vector<std::pair<UUID, AccessEntityPtr>> access_entities,
|
const std::vector<std::pair<UUID, AccessEntityPtr>> & access_entities,
|
||||||
const String & data_path_in_backup,
|
const String & data_path_in_backup,
|
||||||
size_t counter,
|
size_t counter,
|
||||||
const AccessControl & access_control);
|
const AccessControl & access_control);
|
||||||
|
@ -7,7 +7,7 @@ namespace DB
|
|||||||
{
|
{
|
||||||
|
|
||||||
ContextAccessParams::ContextAccessParams(
|
ContextAccessParams::ContextAccessParams(
|
||||||
const std::optional<UUID> user_id_,
|
std::optional<UUID> user_id_,
|
||||||
bool full_access_,
|
bool full_access_,
|
||||||
bool use_default_roles_,
|
bool use_default_roles_,
|
||||||
const std::shared_ptr<const std::vector<UUID>> & current_roles_,
|
const std::shared_ptr<const std::vector<UUID>> & current_roles_,
|
||||||
|
@ -15,7 +15,7 @@ class ContextAccessParams
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ContextAccessParams(
|
ContextAccessParams(
|
||||||
const std::optional<UUID> user_id_,
|
std::optional<UUID> user_id_,
|
||||||
bool full_access_,
|
bool full_access_,
|
||||||
bool use_default_roles_,
|
bool use_default_roles_,
|
||||||
const std::shared_ptr<const std::vector<UUID>> & current_roles_,
|
const std::shared_ptr<const std::vector<UUID>> & current_roles_,
|
||||||
|
@ -34,7 +34,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
explicit GSSAcceptorContext(const Params & params_);
|
explicit GSSAcceptorContext(const Params & params_);
|
||||||
virtual ~GSSAcceptorContext() override;
|
~GSSAcceptorContext() override;
|
||||||
|
|
||||||
GSSAcceptorContext(const GSSAcceptorContext &) = delete;
|
GSSAcceptorContext(const GSSAcceptorContext &) = delete;
|
||||||
GSSAcceptorContext(GSSAcceptorContext &&) = delete;
|
GSSAcceptorContext(GSSAcceptorContext &&) = delete;
|
||||||
|
@ -204,7 +204,7 @@ void LDAPAccessStorage::assignRolesNoLock(User & user, const LDAPClient::SearchR
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LDAPAccessStorage::assignRolesNoLock(User & user, const LDAPClient::SearchResultsList & external_roles, const std::size_t external_roles_hash) const
|
void LDAPAccessStorage::assignRolesNoLock(User & user, const LDAPClient::SearchResultsList & external_roles, std::size_t external_roles_hash) const
|
||||||
{
|
{
|
||||||
const auto & user_name = user.getName();
|
const auto & user_name = user.getName();
|
||||||
auto & granted_roles = user.granted_roles;
|
auto & granted_roles = user.granted_roles;
|
||||||
|
@ -33,29 +33,29 @@ public:
|
|||||||
static constexpr char STORAGE_TYPE[] = "ldap";
|
static constexpr char STORAGE_TYPE[] = "ldap";
|
||||||
|
|
||||||
explicit LDAPAccessStorage(const String & storage_name_, AccessControl & access_control_, const Poco::Util::AbstractConfiguration & config, const String & prefix);
|
explicit LDAPAccessStorage(const String & storage_name_, AccessControl & access_control_, const Poco::Util::AbstractConfiguration & config, const String & prefix);
|
||||||
virtual ~LDAPAccessStorage() override = default;
|
~LDAPAccessStorage() override = default;
|
||||||
|
|
||||||
String getLDAPServerName() const;
|
String getLDAPServerName() const;
|
||||||
|
|
||||||
// IAccessStorage implementations.
|
// IAccessStorage implementations.
|
||||||
virtual const char * getStorageType() const override;
|
const char * getStorageType() const override;
|
||||||
virtual String getStorageParamsJSON() const override;
|
String getStorageParamsJSON() const override;
|
||||||
virtual bool isReadOnly() const override { return true; }
|
bool isReadOnly() const override { return true; }
|
||||||
virtual bool exists(const UUID & id) const override;
|
bool exists(const UUID & id) const override;
|
||||||
|
|
||||||
private: // IAccessStorage implementations.
|
private: // IAccessStorage implementations.
|
||||||
virtual std::optional<UUID> findImpl(AccessEntityType type, const String & name) const override;
|
std::optional<UUID> findImpl(AccessEntityType type, const String & name) const override;
|
||||||
virtual std::vector<UUID> findAllImpl(AccessEntityType type) const override;
|
std::vector<UUID> findAllImpl(AccessEntityType type) const override;
|
||||||
virtual AccessEntityPtr readImpl(const UUID & id, bool throw_if_not_exists) const override;
|
AccessEntityPtr readImpl(const UUID & id, bool throw_if_not_exists) const override;
|
||||||
virtual std::optional<std::pair<String, AccessEntityType>> readNameWithTypeImpl(const UUID & id, bool throw_if_not_exists) const override;
|
std::optional<std::pair<String, AccessEntityType>> readNameWithTypeImpl(const UUID & id, bool throw_if_not_exists) const override;
|
||||||
virtual std::optional<AuthResult> authenticateImpl(const Credentials & credentials, const Poco::Net::IPAddress & address, const ExternalAuthenticators & external_authenticators, bool throw_if_user_not_exists, bool allow_no_password, bool allow_plaintext_password) const override;
|
std::optional<AuthResult> authenticateImpl(const Credentials & credentials, const Poco::Net::IPAddress & address, const ExternalAuthenticators & external_authenticators, bool throw_if_user_not_exists, bool allow_no_password, bool allow_plaintext_password) const override;
|
||||||
|
|
||||||
void setConfiguration(const Poco::Util::AbstractConfiguration & config, const String & prefix);
|
void setConfiguration(const Poco::Util::AbstractConfiguration & config, const String & prefix);
|
||||||
void processRoleChange(const UUID & id, const AccessEntityPtr & entity);
|
void processRoleChange(const UUID & id, const AccessEntityPtr & entity);
|
||||||
|
|
||||||
void applyRoleChangeNoLock(bool grant, const UUID & role_id, const String & role_name);
|
void applyRoleChangeNoLock(bool grant, const UUID & role_id, const String & role_name);
|
||||||
void assignRolesNoLock(User & user, const LDAPClient::SearchResultsList & external_roles) const;
|
void assignRolesNoLock(User & user, const LDAPClient::SearchResultsList & external_roles) const;
|
||||||
void assignRolesNoLock(User & user, const LDAPClient::SearchResultsList & external_roles, const std::size_t external_roles_hash) const;
|
void assignRolesNoLock(User & user, const LDAPClient::SearchResultsList & external_roles, std::size_t external_roles_hash) const;
|
||||||
void updateAssignedRolesNoLock(const UUID & id, const String & user_name, const LDAPClient::SearchResultsList & external_roles) const;
|
void updateAssignedRolesNoLock(const UUID & id, const String & user_name, const LDAPClient::SearchResultsList & external_roles) const;
|
||||||
std::set<String> mapExternalRolesNoLock(const LDAPClient::SearchResultsList & external_roles) const;
|
std::set<String> mapExternalRolesNoLock(const LDAPClient::SearchResultsList & external_roles) const;
|
||||||
bool areLDAPCredentialsValidNoLock(const User & user, const Credentials & credentials,
|
bool areLDAPCredentialsValidNoLock(const User & user, const Credentials & credentials,
|
||||||
|
@ -252,7 +252,6 @@ void dumpFlameGraph(
|
|||||||
fillColumn(chars, offsets, out.str());
|
fillColumn(chars, offsets, out.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOLINTBEGIN(clang-analyzer-optin.performance.Padding)
|
|
||||||
struct AggregateFunctionFlameGraphData
|
struct AggregateFunctionFlameGraphData
|
||||||
{
|
{
|
||||||
struct Entry
|
struct Entry
|
||||||
@ -469,7 +468,6 @@ struct AggregateFunctionFlameGraphData
|
|||||||
DB::dumpFlameGraph(tree.dump(max_depth, min_bytes), chars, offsets);
|
DB::dumpFlameGraph(tree.dump(max_depth, min_bytes), chars, offsets);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// NOLINTEND(clang-analyzer-optin.performance.Padding)
|
|
||||||
|
|
||||||
/// Aggregate function which builds a flamegraph using the list of stacktraces.
|
/// Aggregate function which builds a flamegraph using the list of stacktraces.
|
||||||
/// The output is an array of strings which can be used by flamegraph.pl util.
|
/// The output is an array of strings which can be used by flamegraph.pl util.
|
||||||
|
@ -157,7 +157,7 @@ public:
|
|||||||
|
|
||||||
void update(UInt64 batch_size, std::vector<Float64> & weights, Float64 & bias, Float64 learning_rate, const std::vector<Float64> & batch_gradient) override;
|
void update(UInt64 batch_size, std::vector<Float64> & weights, Float64 & bias, Float64 learning_rate, const std::vector<Float64> & batch_gradient) override;
|
||||||
|
|
||||||
virtual void merge(const IWeightsUpdater & rhs, Float64 frac, Float64 rhs_frac) override;
|
void merge(const IWeightsUpdater & rhs, Float64 frac, Float64 rhs_frac) override;
|
||||||
|
|
||||||
void write(WriteBuffer & buf) const override;
|
void write(WriteBuffer & buf) const override;
|
||||||
|
|
||||||
@ -189,7 +189,7 @@ public:
|
|||||||
|
|
||||||
void update(UInt64 batch_size, std::vector<Float64> & weights, Float64 & bias, Float64 learning_rate, const std::vector<Float64> & batch_gradient) override;
|
void update(UInt64 batch_size, std::vector<Float64> & weights, Float64 & bias, Float64 learning_rate, const std::vector<Float64> & batch_gradient) override;
|
||||||
|
|
||||||
virtual void merge(const IWeightsUpdater & rhs, Float64 frac, Float64 rhs_frac) override;
|
void merge(const IWeightsUpdater & rhs, Float64 frac, Float64 rhs_frac) override;
|
||||||
|
|
||||||
void write(WriteBuffer & buf) const override;
|
void write(WriteBuffer & buf) const override;
|
||||||
|
|
||||||
@ -226,7 +226,7 @@ public:
|
|||||||
|
|
||||||
void update(UInt64 batch_size, std::vector<Float64> & weights, Float64 & bias, Float64 learning_rate, const std::vector<Float64> & batch_gradient) override;
|
void update(UInt64 batch_size, std::vector<Float64> & weights, Float64 & bias, Float64 learning_rate, const std::vector<Float64> & batch_gradient) override;
|
||||||
|
|
||||||
virtual void merge(const IWeightsUpdater & rhs, Float64 frac, Float64 rhs_frac) override;
|
void merge(const IWeightsUpdater & rhs, Float64 frac, Float64 rhs_frac) override;
|
||||||
|
|
||||||
void write(WriteBuffer & buf) const override;
|
void write(WriteBuffer & buf) const override;
|
||||||
|
|
||||||
|
@ -234,9 +234,6 @@ namespace ErrorCodes
|
|||||||
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
template <template <typename> typename FunctionTemplate, StatisticsFunctionKind kind>
|
template <template <typename> typename FunctionTemplate, StatisticsFunctionKind kind>
|
||||||
AggregateFunctionPtr createAggregateFunctionStatisticsUnary(
|
AggregateFunctionPtr createAggregateFunctionStatisticsUnary(
|
||||||
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
|
const std::string & name, const DataTypes & argument_types, const Array & parameters, const Settings *)
|
||||||
@ -273,5 +270,3 @@ AggregateFunctionPtr createAggregateFunctionStatisticsBinary(
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -42,9 +42,6 @@ struct UniqCombinedHashTableGrower : public HashTableGrowerWithPrecalculation<>
|
|||||||
void increaseSize() { increaseSizeDegree(1); }
|
void increaseSize() { increaseSizeDegree(1); }
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
template <typename T, UInt8 K, typename HashValueType>
|
template <typename T, UInt8 K, typename HashValueType>
|
||||||
struct AggregateFunctionUniqCombinedData
|
struct AggregateFunctionUniqCombinedData
|
||||||
{
|
{
|
||||||
@ -268,8 +265,6 @@ AggregateFunctionPtr createAggregateFunctionWithK(const DataTypes & argument_typ
|
|||||||
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunctionVariadic<false, false>>(argument_types, params);
|
return std::make_shared<typename WithK<K, HashValueType>::template AggregateFunctionVariadic<false, false>>(argument_types, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
template <UInt8 K>
|
template <UInt8 K>
|
||||||
AggregateFunctionPtr createAggregateFunctionWithHashType(bool use_64_bit_hash, const DataTypes & argument_types, const Array & params)
|
AggregateFunctionPtr createAggregateFunctionWithHashType(bool use_64_bit_hash, const DataTypes & argument_types, const Array & params)
|
||||||
{
|
{
|
||||||
|
@ -521,7 +521,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
chassert(nullable_filters.size() > 0);
|
chassert(!nullable_filters.empty());
|
||||||
bool found_one = false;
|
bool found_one = false;
|
||||||
if (nullable_filters.size() == 1)
|
if (nullable_filters.size() == 1)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ public:
|
|||||||
offset = other->offset;
|
offset = other->offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
int length()
|
int length() const
|
||||||
{
|
{
|
||||||
return static_cast<int>(bins.size());
|
return static_cast<int>(bins.size());
|
||||||
}
|
}
|
||||||
|
@ -150,7 +150,7 @@ struct QuantileExactExclusive : public QuantileExact<Value>
|
|||||||
return static_cast<Float64>(*std::min_element(array.begin(), array.end()));
|
return static_cast<Float64>(*std::min_element(array.begin(), array.end()));
|
||||||
|
|
||||||
::nth_element(array.begin(), array.begin() + n - 1, array.end());
|
::nth_element(array.begin(), array.begin() + n - 1, array.end());
|
||||||
auto nth_elem = std::min_element(array.begin() + n, array.end());
|
auto * nth_elem = std::min_element(array.begin() + n, array.end());
|
||||||
|
|
||||||
return static_cast<Float64>(array[n - 1]) + (h - n) * static_cast<Float64>(*nth_elem - array[n - 1]);
|
return static_cast<Float64>(array[n - 1]) + (h - n) * static_cast<Float64>(*nth_elem - array[n - 1]);
|
||||||
}
|
}
|
||||||
@ -179,7 +179,7 @@ struct QuantileExactExclusive : public QuantileExact<Value>
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
::nth_element(array.begin() + prev_n, array.begin() + n - 1, array.end());
|
::nth_element(array.begin() + prev_n, array.begin() + n - 1, array.end());
|
||||||
auto nth_elem = std::min_element(array.begin() + n, array.end());
|
auto * nth_elem = std::min_element(array.begin() + n, array.end());
|
||||||
|
|
||||||
result[indices[i]] = static_cast<Float64>(array[n - 1]) + (h - n) * static_cast<Float64>(*nth_elem - array[n - 1]);
|
result[indices[i]] = static_cast<Float64>(array[n - 1]) + (h - n) * static_cast<Float64>(*nth_elem - array[n - 1]);
|
||||||
prev_n = n - 1;
|
prev_n = n - 1;
|
||||||
@ -214,7 +214,7 @@ struct QuantileExactInclusive : public QuantileExact<Value>
|
|||||||
else if (n < 1)
|
else if (n < 1)
|
||||||
return static_cast<Float64>(*std::min_element(array.begin(), array.end()));
|
return static_cast<Float64>(*std::min_element(array.begin(), array.end()));
|
||||||
::nth_element(array.begin(), array.begin() + n - 1, array.end());
|
::nth_element(array.begin(), array.begin() + n - 1, array.end());
|
||||||
auto nth_elem = std::min_element(array.begin() + n, array.end());
|
auto * nth_elem = std::min_element(array.begin() + n, array.end());
|
||||||
|
|
||||||
return static_cast<Float64>(array[n - 1]) + (h - n) * static_cast<Float64>(*nth_elem - array[n - 1]);
|
return static_cast<Float64>(array[n - 1]) + (h - n) * static_cast<Float64>(*nth_elem - array[n - 1]);
|
||||||
}
|
}
|
||||||
@ -241,7 +241,7 @@ struct QuantileExactInclusive : public QuantileExact<Value>
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
::nth_element(array.begin() + prev_n, array.begin() + n - 1, array.end());
|
::nth_element(array.begin() + prev_n, array.begin() + n - 1, array.end());
|
||||||
auto nth_elem = std::min_element(array.begin() + n, array.end());
|
auto * nth_elem = std::min_element(array.begin() + n, array.end());
|
||||||
|
|
||||||
result[indices[i]] = static_cast<Float64>(array[n - 1]) + (h - n) * (static_cast<Float64>(*nth_elem) - array[n - 1]);
|
result[indices[i]] = static_cast<Float64>(array[n - 1]) + (h - n) * (static_cast<Float64>(*nth_elem) - array[n - 1]);
|
||||||
prev_n = n - 1;
|
prev_n = n - 1;
|
||||||
|
@ -191,7 +191,7 @@ public:
|
|||||||
/// TODO: After implementation of "versioning aggregate function state",
|
/// TODO: After implementation of "versioning aggregate function state",
|
||||||
/// change the serialization format.
|
/// change the serialization format.
|
||||||
Element elem;
|
Element elem;
|
||||||
memset(&elem, 0, sizeof(elem));
|
memset(&elem, 0, sizeof(elem)); /// NOLINT(bugprone-undefined-memory-manipulation)
|
||||||
elem = samples[i];
|
elem = samples[i];
|
||||||
|
|
||||||
DB::transformEndianness<std::endian::little>(elem);
|
DB::transformEndianness<std::endian::little>(elem);
|
||||||
|
@ -23,7 +23,7 @@ struct SingleValueDataBase
|
|||||||
/// For example argMin holds 1 of these (for the result), while keeping a template for the value
|
/// For example argMin holds 1 of these (for the result), while keeping a template for the value
|
||||||
static constexpr UInt32 MAX_STORAGE_SIZE = 64;
|
static constexpr UInt32 MAX_STORAGE_SIZE = 64;
|
||||||
|
|
||||||
virtual ~SingleValueDataBase() { }
|
virtual ~SingleValueDataBase() = default;
|
||||||
virtual bool has() const = 0;
|
virtual bool has() const = 0;
|
||||||
virtual void insertResultInto(IColumn &) const = 0;
|
virtual void insertResultInto(IColumn &) const = 0;
|
||||||
virtual void write(WriteBuffer &, const ISerialization &) const = 0;
|
virtual void write(WriteBuffer &, const ISerialization &) const = 0;
|
||||||
|
@ -39,8 +39,8 @@ public:
|
|||||||
/// This method will convert all the SingleLevelSet to TwoLevelSet in parallel if the hashsets are not all singlelevel or not all twolevel.
|
/// This method will convert all the SingleLevelSet to TwoLevelSet in parallel if the hashsets are not all singlelevel or not all twolevel.
|
||||||
static void parallelizeMergePrepare(const std::vector<UniqExactSet *> & data_vec, ThreadPool & thread_pool)
|
static void parallelizeMergePrepare(const std::vector<UniqExactSet *> & data_vec, ThreadPool & thread_pool)
|
||||||
{
|
{
|
||||||
unsigned long single_level_set_num = 0;
|
UInt64 single_level_set_num = 0;
|
||||||
unsigned long all_single_hash_size = 0;
|
UInt64 all_single_hash_size = 0;
|
||||||
|
|
||||||
for (auto ele : data_vec)
|
for (auto ele : data_vec)
|
||||||
{
|
{
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
* Available expression columns are extracted from table expression.
|
* Available expression columns are extracted from table expression.
|
||||||
* Table expression node must have query, union, table, table function type.
|
* Table expression node must have query, union, table, table function type.
|
||||||
*/
|
*/
|
||||||
QueryAnalysisPass(QueryTreeNodePtr table_expression_, bool only_analyze_ = false);
|
explicit QueryAnalysisPass(QueryTreeNodePtr table_expression_, bool only_analyze_ = false);
|
||||||
|
|
||||||
String getName() override
|
String getName() override
|
||||||
{
|
{
|
||||||
|
@ -26,7 +26,7 @@ struct BackupSettings
|
|||||||
String password;
|
String password;
|
||||||
|
|
||||||
/// S3 storage class.
|
/// S3 storage class.
|
||||||
String s3_storage_class = "";
|
String s3_storage_class;
|
||||||
|
|
||||||
/// If this is set to true then only create queries will be written to backup,
|
/// If this is set to true then only create queries will be written to backup,
|
||||||
/// without the data of tables.
|
/// without the data of tables.
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
|
|
||||||
/// Returns names of entries stored in a specified directory in the backup.
|
/// Returns names of entries stored in a specified directory in the backup.
|
||||||
/// If `directory` is empty or '/' the functions returns entries in the backup's root.
|
/// If `directory` is empty or '/' the functions returns entries in the backup's root.
|
||||||
virtual Strings listFiles(const String & directory, bool recursive = false) const = 0;
|
virtual Strings listFiles(const String & directory, bool recursive) const = 0;
|
||||||
|
|
||||||
/// Checks if a specified directory contains any files.
|
/// Checks if a specified directory contains any files.
|
||||||
/// The function returns the same as `!listFiles(directory).empty()`.
|
/// The function returns the same as `!listFiles(directory).empty()`.
|
||||||
@ -108,11 +108,9 @@ public:
|
|||||||
virtual std::unique_ptr<SeekableReadBuffer> readFile(const SizeAndChecksum & size_and_checksum) const = 0;
|
virtual std::unique_ptr<SeekableReadBuffer> readFile(const SizeAndChecksum & size_and_checksum) const = 0;
|
||||||
|
|
||||||
/// Copies a file from the backup to a specified destination disk. Returns the number of bytes written.
|
/// Copies a file from the backup to a specified destination disk. Returns the number of bytes written.
|
||||||
virtual size_t copyFileToDisk(const String & file_name, DiskPtr destination_disk, const String & destination_path,
|
virtual size_t copyFileToDisk(const String & file_name, DiskPtr destination_disk, const String & destination_path, WriteMode write_mode) const = 0;
|
||||||
WriteMode write_mode = WriteMode::Rewrite) const = 0;
|
|
||||||
|
|
||||||
virtual size_t copyFileToDisk(const SizeAndChecksum & size_and_checksum, DiskPtr destination_disk, const String & destination_path,
|
virtual size_t copyFileToDisk(const SizeAndChecksum & size_and_checksum, DiskPtr destination_disk, const String & destination_path, WriteMode write_mode) const = 0;
|
||||||
WriteMode write_mode = WriteMode::Rewrite) const = 0;
|
|
||||||
|
|
||||||
/// Puts a new entry to the backup.
|
/// Puts a new entry to the backup.
|
||||||
virtual void writeFile(const BackupFileInfo & file_info, BackupEntryPtr entry) = 0;
|
virtual void writeFile(const BackupFileInfo & file_info, BackupEntryPtr entry) = 0;
|
||||||
|
@ -273,7 +273,7 @@ void RestorerFromBackup::findRootPathsInBackup()
|
|||||||
root_paths_in_backup.push_back(root_path);
|
root_paths_in_backup.push_back(root_path);
|
||||||
|
|
||||||
/// Add shard-related part to the root path.
|
/// Add shard-related part to the root path.
|
||||||
Strings shards_in_backup = backup->listFiles(root_path / "shards");
|
Strings shards_in_backup = backup->listFiles(root_path / "shards", /*recursive*/ false);
|
||||||
if (shards_in_backup.empty())
|
if (shards_in_backup.empty())
|
||||||
{
|
{
|
||||||
if (restore_settings.shard_num_in_backup > 1)
|
if (restore_settings.shard_num_in_backup > 1)
|
||||||
@ -295,7 +295,7 @@ void RestorerFromBackup::findRootPathsInBackup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Add replica-related part to the root path.
|
/// Add replica-related part to the root path.
|
||||||
Strings replicas_in_backup = backup->listFiles(root_path / "replicas");
|
Strings replicas_in_backup = backup->listFiles(root_path / "replicas", /*recursive*/ false);
|
||||||
if (replicas_in_backup.empty())
|
if (replicas_in_backup.empty())
|
||||||
{
|
{
|
||||||
if (restore_settings.replica_num_in_backup > 1)
|
if (restore_settings.replica_num_in_backup > 1)
|
||||||
@ -514,7 +514,7 @@ void RestorerFromBackup::findDatabaseInBackupImpl(const String & database_name_i
|
|||||||
if (!metadata_path && !try_metadata_path.empty() && backup->fileExists(try_metadata_path))
|
if (!metadata_path && !try_metadata_path.empty() && backup->fileExists(try_metadata_path))
|
||||||
metadata_path = try_metadata_path;
|
metadata_path = try_metadata_path;
|
||||||
|
|
||||||
Strings file_names = backup->listFiles(try_tables_metadata_path);
|
Strings file_names = backup->listFiles(try_tables_metadata_path, /*recursive*/ false);
|
||||||
for (const String & file_name : file_names)
|
for (const String & file_name : file_names)
|
||||||
{
|
{
|
||||||
if (!file_name.ends_with(".sql"))
|
if (!file_name.ends_with(".sql"))
|
||||||
@ -575,7 +575,7 @@ void RestorerFromBackup::findEverythingInBackup(const std::set<String> & except_
|
|||||||
|
|
||||||
for (const auto & root_path_in_backup : root_paths_in_backup)
|
for (const auto & root_path_in_backup : root_paths_in_backup)
|
||||||
{
|
{
|
||||||
Strings file_names = backup->listFiles(root_path_in_backup / "metadata");
|
Strings file_names = backup->listFiles(root_path_in_backup / "metadata", /*recursive*/ false);
|
||||||
for (String & file_name : file_names)
|
for (String & file_name : file_names)
|
||||||
{
|
{
|
||||||
if (file_name.ends_with(".sql"))
|
if (file_name.ends_with(".sql"))
|
||||||
|
@ -159,7 +159,7 @@ private:
|
|||||||
size_t requested_connections_count = 0;
|
size_t requested_connections_count = 0;
|
||||||
|
|
||||||
const size_t max_parallel_replicas = 0;
|
const size_t max_parallel_replicas = 0;
|
||||||
const bool skip_unavailable_shards = 0;
|
const bool skip_unavailable_shards = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -77,12 +77,12 @@ private:
|
|||||||
{
|
{
|
||||||
if (actual_server_error && std::find(server_errors.begin(), server_errors.end(), actual_server_error) == server_errors.end())
|
if (actual_server_error && std::find(server_errors.begin(), server_errors.end(), actual_server_error) == server_errors.end())
|
||||||
return false;
|
return false;
|
||||||
if (!actual_server_error && server_errors.size())
|
if (!actual_server_error && !server_errors.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (actual_client_error && std::find(client_errors.begin(), client_errors.end(), actual_client_error) == client_errors.end())
|
if (actual_client_error && std::find(client_errors.begin(), client_errors.end(), actual_client_error) == client_errors.end())
|
||||||
return false;
|
return false;
|
||||||
if (!actual_client_error && client_errors.size())
|
if (!actual_client_error && !client_errors.empty())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -90,7 +90,7 @@ private:
|
|||||||
|
|
||||||
bool lostExpectedError(int actual_server_error, int actual_client_error) const
|
bool lostExpectedError(int actual_server_error, int actual_client_error) const
|
||||||
{
|
{
|
||||||
return (server_errors.size() && !actual_server_error) || (client_errors.size() && !actual_client_error);
|
return (!server_errors.empty() && !actual_server_error) || (!client_errors.empty() && !actual_client_error);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -671,7 +671,7 @@ IColumnUnique::IndexesWithOverflow ColumnUnique<ColumnType>::uniqueInsertRangeWi
|
|||||||
size_t max_dictionary_size)
|
size_t max_dictionary_size)
|
||||||
{
|
{
|
||||||
auto overflowed_keys = column_holder->cloneEmpty();
|
auto overflowed_keys = column_holder->cloneEmpty();
|
||||||
auto overflowed_keys_ptr = typeid_cast<ColumnType *>(overflowed_keys.get());
|
auto * overflowed_keys_ptr = typeid_cast<ColumnType *>(overflowed_keys.get());
|
||||||
if (!overflowed_keys_ptr)
|
if (!overflowed_keys_ptr)
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid keys type for ColumnUnique.");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "Invalid keys type for ColumnUnique.");
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ struct ReverseIndexHashTableCell
|
|||||||
{
|
{
|
||||||
/// Careful: apparently this uses SFINAE to redefine isZero for all types
|
/// Careful: apparently this uses SFINAE to redefine isZero for all types
|
||||||
/// except the IndexType, for which the default ZeroTraits::isZero is used.
|
/// except the IndexType, for which the default ZeroTraits::isZero is used.
|
||||||
static_assert(!std::is_same_v<typename std::decay<T>::type, typename std::decay<IndexType>::type>);
|
static_assert(!std::is_same_v<typename std::decay_t<T>, typename std::decay_t<IndexType>>);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,10 +26,10 @@ struct AllocatorWithMemoryTracking
|
|||||||
|
|
||||||
[[nodiscard]] T * allocate(size_t n)
|
[[nodiscard]] T * allocate(size_t n)
|
||||||
{
|
{
|
||||||
if (n > std::numeric_limits<size_t>::max() / sizeof(T))
|
if (n > std::numeric_limits<size_t>::max() / sizeof(T)) /// NOLINT(bugprone-sizeof-expression)
|
||||||
throw std::bad_alloc();
|
throw std::bad_alloc();
|
||||||
|
|
||||||
size_t bytes = n * sizeof(T);
|
size_t bytes = n * sizeof(T); /// NOLINT(bugprone-sizeof-expression)
|
||||||
auto trace = CurrentMemoryTracker::alloc(bytes);
|
auto trace = CurrentMemoryTracker::alloc(bytes);
|
||||||
|
|
||||||
T * p = static_cast<T *>(malloc(bytes));
|
T * p = static_cast<T *>(malloc(bytes));
|
||||||
@ -43,7 +43,7 @@ struct AllocatorWithMemoryTracking
|
|||||||
|
|
||||||
void deallocate(T * p, size_t n) noexcept
|
void deallocate(T * p, size_t n) noexcept
|
||||||
{
|
{
|
||||||
size_t bytes = n * sizeof(T);
|
size_t bytes = n * sizeof(T); /// NOLINT(bugprone-sizeof-expression)
|
||||||
|
|
||||||
free(p);
|
free(p);
|
||||||
auto trace = CurrentMemoryTracker::free(bytes);
|
auto trace = CurrentMemoryTracker::free(bytes);
|
||||||
|
@ -49,7 +49,7 @@ private:
|
|||||||
|
|
||||||
MemoryChunk() = default;
|
MemoryChunk() = default;
|
||||||
|
|
||||||
void swap(MemoryChunk & other)
|
void swap(MemoryChunk & other) noexcept
|
||||||
{
|
{
|
||||||
std::swap(begin, other.begin);
|
std::swap(begin, other.begin);
|
||||||
std::swap(pos, other.pos);
|
std::swap(pos, other.pos);
|
||||||
@ -57,12 +57,12 @@ private:
|
|||||||
prev.swap(other.prev);
|
prev.swap(other.prev);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryChunk(MemoryChunk && other)
|
MemoryChunk(MemoryChunk && other) noexcept
|
||||||
{
|
{
|
||||||
*this = std::move(other);
|
*this = std::move(other);
|
||||||
}
|
}
|
||||||
|
|
||||||
MemoryChunk & operator=(MemoryChunk && other)
|
MemoryChunk & operator=(MemoryChunk && other) noexcept
|
||||||
{
|
{
|
||||||
swap(other);
|
swap(other);
|
||||||
return *this;
|
return *this;
|
||||||
|
@ -47,7 +47,6 @@ public:
|
|||||||
HashMap<UInt16, Float64> map;
|
HashMap<UInt16, Float64> map;
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
|
||||||
using Map = HashMap<StringRef, Float64>;
|
using Map = HashMap<StringRef, Float64>;
|
||||||
using Container = std::vector<Language>;
|
using Container = std::vector<Language>;
|
||||||
|
|
||||||
|
@ -44,11 +44,12 @@ public:
|
|||||||
virtual const Metrics & getMetrics() const = 0;
|
virtual const Metrics & getMetrics() const = 0;
|
||||||
virtual ~IHTTPConnectionPoolForEndpoint() = default;
|
virtual ~IHTTPConnectionPoolForEndpoint() = default;
|
||||||
|
|
||||||
|
IHTTPConnectionPoolForEndpoint(const IHTTPConnectionPoolForEndpoint &) = delete;
|
||||||
|
IHTTPConnectionPoolForEndpoint & operator=(const IHTTPConnectionPoolForEndpoint &) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
IHTTPConnectionPoolForEndpoint() = default;
|
IHTTPConnectionPoolForEndpoint() = default;
|
||||||
|
|
||||||
IHTTPConnectionPoolForEndpoint(const IHTTPConnectionPoolForEndpoint &) = delete;
|
|
||||||
IHTTPConnectionPoolForEndpoint & operator=(const IHTTPConnectionPoolForEndpoint &) = delete;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class HTTPConnectionGroupType
|
enum class HTTPConnectionGroupType
|
||||||
@ -70,11 +71,12 @@ public:
|
|||||||
static constexpr size_t warning_step = 100;
|
static constexpr size_t warning_step = 100;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
|
||||||
HTTPConnectionPools();
|
|
||||||
HTTPConnectionPools(const HTTPConnectionPools &) = delete;
|
HTTPConnectionPools(const HTTPConnectionPools &) = delete;
|
||||||
HTTPConnectionPools & operator=(const HTTPConnectionPools &) = delete;
|
HTTPConnectionPools & operator=(const HTTPConnectionPools &) = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
HTTPConnectionPools();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static HTTPConnectionPools & instance();
|
static HTTPConnectionPools & instance();
|
||||||
|
|
||||||
|
@ -92,7 +92,8 @@ inline bool bitEquals(T && a, T && b)
|
|||||||
using RealT = std::decay_t<T>;
|
using RealT = std::decay_t<T>;
|
||||||
|
|
||||||
if constexpr (std::is_floating_point_v<RealT>)
|
if constexpr (std::is_floating_point_v<RealT>)
|
||||||
return 0 == memcmp(&a, &b, sizeof(RealT)); /// Note that memcmp with constant size is compiler builtin.
|
/// Note that memcmp with constant size is compiler builtin.
|
||||||
|
return 0 == memcmp(&a, &b, sizeof(RealT)); /// NOLINT
|
||||||
else
|
else
|
||||||
return a == b;
|
return a == b;
|
||||||
}
|
}
|
||||||
@ -644,7 +645,7 @@ protected:
|
|||||||
|
|
||||||
/// Copy to a new location and zero the old one.
|
/// Copy to a new location and zero the old one.
|
||||||
x.setHash(hash_value);
|
x.setHash(hash_value);
|
||||||
memcpy(static_cast<void*>(&buf[place_value]), &x, sizeof(x));
|
memcpy(static_cast<void*>(&buf[place_value]), &x, sizeof(x)); /// NOLINT(bugprone-undefined-memory-manipulation)
|
||||||
x.setZero();
|
x.setZero();
|
||||||
|
|
||||||
/// Then the elements that previously were in collision with this can move to the old place.
|
/// Then the elements that previously were in collision with this can move to the old place.
|
||||||
|
@ -67,8 +67,8 @@ public:
|
|||||||
class Entry
|
class Entry
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit Entry(Entry && entry) = default;
|
Entry(Entry && entry) = default;
|
||||||
explicit Entry(Entry & entry) = delete;
|
Entry(Entry & entry) = delete;
|
||||||
|
|
||||||
// no access as r-value
|
// no access as r-value
|
||||||
const String * operator->() && = delete;
|
const String * operator->() && = delete;
|
||||||
@ -89,7 +89,7 @@ public:
|
|||||||
|
|
||||||
Entry(HostResolver & pool_, Poco::Net::IPAddress address_)
|
Entry(HostResolver & pool_, Poco::Net::IPAddress address_)
|
||||||
: pool(pool_.getWeakFromThis())
|
: pool(pool_.getWeakFromThis())
|
||||||
, address(std::move(address_))
|
, address(address_)
|
||||||
, resolved_host(address.toString())
|
, resolved_host(address.toString())
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@ -126,14 +126,14 @@ protected:
|
|||||||
struct Record
|
struct Record
|
||||||
{
|
{
|
||||||
Record(Poco::Net::IPAddress address_, Poco::Timestamp resolve_time_)
|
Record(Poco::Net::IPAddress address_, Poco::Timestamp resolve_time_)
|
||||||
: address(std::move(address_))
|
: address(address_)
|
||||||
, resolve_time(resolve_time_)
|
, resolve_time(resolve_time_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
explicit Record(Record && rec) = default;
|
Record(Record && rec) = default;
|
||||||
Record& operator=(Record && s) = default;
|
Record& operator=(Record && s) = default;
|
||||||
|
|
||||||
explicit Record(const Record & rec) = default;
|
Record(const Record & rec) = default;
|
||||||
Record& operator=(const Record & s) = default;
|
Record& operator=(const Record & s) = default;
|
||||||
|
|
||||||
Poco::Net::IPAddress address;
|
Poco::Net::IPAddress address;
|
||||||
@ -198,10 +198,11 @@ class HostResolversPool
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
HostResolversPool() = default;
|
HostResolversPool() = default;
|
||||||
|
|
||||||
|
public:
|
||||||
HostResolversPool(const HostResolversPool &) = delete;
|
HostResolversPool(const HostResolversPool &) = delete;
|
||||||
HostResolversPool & operator=(const HostResolversPool &) = delete;
|
HostResolversPool & operator=(const HostResolversPool &) = delete;
|
||||||
|
|
||||||
public:
|
|
||||||
static HostResolversPool & instance();
|
static HostResolversPool & instance();
|
||||||
|
|
||||||
void dropCache();
|
void dropCache();
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
namespace
|
namespace impl
|
||||||
{
|
{
|
||||||
/// After the most significant bit 1, set all subsequent less significant bits to 1 as well.
|
/// After the most significant bit 1, set all subsequent less significant bits to 1 as well.
|
||||||
inline UInt64 toMask(UInt64 n)
|
inline UInt64 toMask(UInt64 n)
|
||||||
@ -85,7 +85,7 @@ void intervalBinaryPartition(UInt64 first, UInt64 last, F && callback)
|
|||||||
/// split = 15: 00001111
|
/// split = 15: 00001111
|
||||||
|
|
||||||
UInt64 diff = first ^ last;
|
UInt64 diff = first ^ last;
|
||||||
UInt64 mask = toMask(diff) >> 1;
|
UInt64 mask = impl::toMask(diff) >> 1;
|
||||||
|
|
||||||
/// The current interval represents a whole range with fixed prefix.
|
/// The current interval represents a whole range with fixed prefix.
|
||||||
if ((first & mask) == 0 && (last & mask) == mask)
|
if ((first & mask) == 0 && (last & mask) == mask)
|
||||||
|
@ -29,7 +29,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
NetException * clone() const override { return new NetException(*this); }
|
NetException * clone() const override { return new NetException(*this); }
|
||||||
void rethrow() const override { throw *this; }
|
void rethrow() const override { throw *this; } /// NOLINT(cert-err60-cpp)
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char * name() const noexcept override { return "DB::NetException"; }
|
const char * name() const noexcept override { return "DB::NetException"; }
|
||||||
|
@ -301,6 +301,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// NOLINTBEGIN(bugprone-sizeof-expression)
|
||||||
|
|
||||||
template <typename T, size_t initial_bytes, typename TAllocator, size_t pad_right_, size_t pad_left_>
|
template <typename T, size_t initial_bytes, typename TAllocator, size_t pad_right_, size_t pad_left_>
|
||||||
class PODArray : public PODArrayBase<sizeof(T), initial_bytes, TAllocator, pad_right_, pad_left_>
|
class PODArray : public PODArrayBase<sizeof(T), initial_bytes, TAllocator, pad_right_, pad_left_>
|
||||||
{
|
{
|
||||||
@ -755,6 +757,8 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// NOLINTEND(bugprone-sizeof-expression)
|
||||||
|
|
||||||
template <typename T, size_t initial_bytes, typename TAllocator, size_t pad_right_, size_t pad_left_>
|
template <typename T, size_t initial_bytes, typename TAllocator, size_t pad_right_, size_t pad_left_>
|
||||||
void swap(PODArray<T, initial_bytes, TAllocator, pad_right_, pad_left_> & lhs, PODArray<T, initial_bytes, TAllocator, pad_right_, pad_left_> & rhs) /// NOLINT
|
void swap(PODArray<T, initial_bytes, TAllocator, pad_right_, pad_left_> & lhs, PODArray<T, initial_bytes, TAllocator, pad_right_, pad_left_> & rhs) /// NOLINT
|
||||||
{
|
{
|
||||||
|
@ -50,7 +50,7 @@ struct ProxyConfiguration
|
|||||||
bool tunneling = false;
|
bool tunneling = false;
|
||||||
Protocol original_request_protocol = Protocol::HTTP;
|
Protocol original_request_protocol = Protocol::HTTP;
|
||||||
|
|
||||||
bool isEmpty() const { return host.size() == 0; }
|
bool isEmpty() const { return host.empty(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,6 @@ private:
|
|||||||
StatePtr state; // hold state to avoid ResourceLink invalidation due to resource deregistration from SchedulerRoot
|
StatePtr state; // hold state to avoid ResourceLink invalidation due to resource deregistration from SchedulerRoot
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
|
||||||
SchedulerRoot scheduler;
|
SchedulerRoot scheduler;
|
||||||
std::mutex mutex;
|
std::mutex mutex;
|
||||||
StatePtr state;
|
StatePtr state;
|
||||||
|
@ -248,7 +248,6 @@ private:
|
|||||||
parent->activateChild(this);
|
parent->activateChild(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
/// Beginning of `items` vector is heap of active children: [0; `heap_size`).
|
/// Beginning of `items` vector is heap of active children: [0; `heap_size`).
|
||||||
/// Next go inactive children in unsorted order.
|
/// Next go inactive children in unsorted order.
|
||||||
/// NOTE: we have to track vruntime of inactive children for max-min fairness.
|
/// NOTE: we have to track vruntime of inactive children for max-min fairness.
|
||||||
|
@ -231,7 +231,6 @@ private:
|
|||||||
value->next = nullptr;
|
value->next = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
void schedulerThread()
|
void schedulerThread()
|
||||||
{
|
{
|
||||||
while (!stop_flag.load())
|
while (!stop_flag.load())
|
||||||
@ -253,7 +252,6 @@ private:
|
|||||||
request->execute();
|
request->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
TResource * current = nullptr; // round-robin pointer
|
TResource * current = nullptr; // round-robin pointer
|
||||||
std::unordered_map<ISchedulerNode *, TResource> children; // resources by pointer
|
std::unordered_map<ISchedulerNode *, TResource> children; // resources by pointer
|
||||||
std::atomic<bool> stop_flag = false;
|
std::atomic<bool> stop_flag = false;
|
||||||
|
@ -291,7 +291,7 @@ private:
|
|||||||
class ThreadReference
|
class ThreadReference
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const ThreadReference & operator = (ThreadFromGlobalPool && thread_)
|
ThreadReference & operator = (ThreadFromGlobalPool && thread_)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> l(lock);
|
std::lock_guard<std::mutex> l(lock);
|
||||||
thread = std::move(thread_);
|
thread = std::move(thread_);
|
||||||
|
@ -120,7 +120,7 @@ public:
|
|||||||
|
|
||||||
iteration_succeeded = false;
|
iteration_succeeded = false;
|
||||||
user_error.code = code;
|
user_error.code = code;
|
||||||
user_error.message = std::move(message);
|
user_error.message = message;
|
||||||
user_error.exception = exception;
|
user_error.exception = exception;
|
||||||
keeper_error = KeeperError{};
|
keeper_error = KeeperError{};
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ inline ALWAYS_INLINE size_t untrackMemory(void * ptr [[maybe_unused]], Allocatio
|
|||||||
#endif
|
#endif
|
||||||
trace = CurrentMemoryTracker::free(actual_size);
|
trace = CurrentMemoryTracker::free(actual_size);
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...) /// NOLINT(bugprone-empty-catch)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
if (!finished)
|
if (!finished)
|
||||||
rollback();
|
rollback();
|
||||||
}
|
}
|
||||||
catch (...)
|
catch (...) /// NOLINT(bugprone-empty-catch)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ using Int64 = int64_t;
|
|||||||
using UInt32 = uint32_t;
|
using UInt32 = uint32_t;
|
||||||
using Int32 = int32_t;
|
using Int32 = int32_t;
|
||||||
|
|
||||||
using MYSQL_LENGTH = unsigned long;
|
using MYSQL_LENGTH = unsigned long; /// NOLINT
|
||||||
using MYSQL_LENGTHS = MYSQL_LENGTH *;
|
using MYSQL_LENGTHS = MYSQL_LENGTH *;
|
||||||
using MYSQL_FIELDS = MYSQL_FIELD *;
|
using MYSQL_FIELDS = MYSQL_FIELD *;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ template <typename Result, typename T>
|
|||||||
std::future<Result> scheduleFromThreadPool(T && task, ThreadPool & pool, const std::string & thread_name, Priority priority = {})
|
std::future<Result> scheduleFromThreadPool(T && task, ThreadPool & pool, const std::string & thread_name, Priority priority = {})
|
||||||
{
|
{
|
||||||
auto schedule = threadPoolCallbackRunner<Result, T>(pool, thread_name);
|
auto schedule = threadPoolCallbackRunner<Result, T>(pool, thread_name);
|
||||||
return schedule(std::move(task), priority);
|
return schedule(std::move(task), priority); /// NOLINT
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ public:
|
|||||||
|
|
||||||
qpl_job * acquireJob(UInt32 & job_id);
|
qpl_job * acquireJob(UInt32 & job_id);
|
||||||
void releaseJob(UInt32 job_id);
|
void releaseJob(UInt32 job_id);
|
||||||
const bool & isJobPoolReady() { return job_pool_ready; }
|
const bool & isJobPoolReady() const { return job_pool_ready; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool tryLockJob(UInt32 index);
|
bool tryLockJob(UInt32 index);
|
||||||
|
@ -16,7 +16,7 @@ public:
|
|||||||
~WriteBufferFromNuraftBuffer() override;
|
~WriteBufferFromNuraftBuffer() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void finalizeImpl() override final;
|
void finalizeImpl() final;
|
||||||
|
|
||||||
void nextImpl() override;
|
void nextImpl() override;
|
||||||
|
|
||||||
|
@ -40,6 +40,7 @@ using FieldVector = std::vector<Field, AllocatorWithMemoryTracking<Field>>;
|
|||||||
/// construct a Field of Array or a Tuple type. An alternative approach would be
|
/// construct a Field of Array or a Tuple type. An alternative approach would be
|
||||||
/// to construct both of these types from FieldVector, and have the caller
|
/// to construct both of these types from FieldVector, and have the caller
|
||||||
/// specify the desired Field type explicitly.
|
/// specify the desired Field type explicitly.
|
||||||
|
/// NOLINTBEGIN(modernize-type-traits)
|
||||||
#define DEFINE_FIELD_VECTOR(X) \
|
#define DEFINE_FIELD_VECTOR(X) \
|
||||||
struct X : public FieldVector \
|
struct X : public FieldVector \
|
||||||
{ \
|
{ \
|
||||||
@ -48,6 +49,7 @@ struct X : public FieldVector \
|
|||||||
|
|
||||||
DEFINE_FIELD_VECTOR(Array);
|
DEFINE_FIELD_VECTOR(Array);
|
||||||
DEFINE_FIELD_VECTOR(Tuple);
|
DEFINE_FIELD_VECTOR(Tuple);
|
||||||
|
/// NOLINTEND(modernize-type-traits)
|
||||||
|
|
||||||
/// An array with the following structure: [(key1, value1), (key2, value2), ...]
|
/// An array with the following structure: [(key1, value1), (key2, value2), ...]
|
||||||
DEFINE_FIELD_VECTOR(Map); /// TODO: use map instead of vector.
|
DEFINE_FIELD_VECTOR(Map); /// TODO: use map instead of vector.
|
||||||
|
@ -546,7 +546,7 @@ namespace MySQLReplication
|
|||||||
virtual void setGTIDSets(GTIDSets sets) = 0;
|
virtual void setGTIDSets(GTIDSets sets) = 0;
|
||||||
virtual void setChecksumSignatureLength(size_t checksum_signature_length_) = 0;
|
virtual void setChecksumSignatureLength(size_t checksum_signature_length_) = 0;
|
||||||
|
|
||||||
virtual ~IFlavor() override = default;
|
~IFlavor() override = default;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MySQLFlavor : public IFlavor
|
class MySQLFlavor : public IFlavor
|
||||||
|
@ -1198,7 +1198,6 @@ class IColumn;
|
|||||||
FORMAT_FACTORY_SETTINGS(M, ALIAS) \
|
FORMAT_FACTORY_SETTINGS(M, ALIAS) \
|
||||||
OBSOLETE_FORMAT_SETTINGS(M, ALIAS) \
|
OBSOLETE_FORMAT_SETTINGS(M, ALIAS) \
|
||||||
|
|
||||||
/// NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
|
|
||||||
DECLARE_SETTINGS_TRAITS_ALLOW_CUSTOM_SETTINGS(SettingsTraits, LIST_OF_SETTINGS)
|
DECLARE_SETTINGS_TRAITS_ALLOW_CUSTOM_SETTINGS(SettingsTraits, LIST_OF_SETTINGS)
|
||||||
|
|
||||||
|
|
||||||
@ -1243,7 +1242,6 @@ private:
|
|||||||
/*
|
/*
|
||||||
* User-specified file format settings for File and URL engines.
|
* User-specified file format settings for File and URL engines.
|
||||||
*/
|
*/
|
||||||
/// NOLINTNEXTLINE(clang-analyzer-optin.performance.Padding)
|
|
||||||
DECLARE_SETTINGS_TRAITS(FormatFactorySettingsTraits, LIST_OF_ALL_FORMAT_SETTINGS)
|
DECLARE_SETTINGS_TRAITS(FormatFactorySettingsTraits, LIST_OF_ALL_FORMAT_SETTINGS)
|
||||||
|
|
||||||
struct FormatFactorySettings : public BaseSettings<FormatFactorySettingsTraits>
|
struct FormatFactorySettings : public BaseSettings<FormatFactorySettingsTraits>
|
||||||
|
@ -5,14 +5,12 @@
|
|||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
// NOLINTBEGIN(clang-analyzer-optin.performance.Padding)
|
|
||||||
struct CheckResult
|
struct CheckResult
|
||||||
{
|
{
|
||||||
Int32 id;
|
Int32 id;
|
||||||
String name;
|
String name;
|
||||||
bool need_convert;
|
bool need_convert;
|
||||||
};
|
};
|
||||||
// NOLINTEND(clang-analyzer-optin.performance.Padding)
|
|
||||||
|
|
||||||
TEST(CharsetTest, CharsetTest)
|
TEST(CharsetTest, CharsetTest)
|
||||||
{
|
{
|
||||||
|
@ -103,7 +103,7 @@ public:
|
|||||||
|
|
||||||
GraphiteWriter * getGraphiteWriter(const std::string & config_name = DEFAULT_GRAPHITE_CONFIG_NAME)
|
GraphiteWriter * getGraphiteWriter(const std::string & config_name = DEFAULT_GRAPHITE_CONFIG_NAME)
|
||||||
{
|
{
|
||||||
if (graphite_writers.count(config_name))
|
if (graphite_writers.contains(config_name))
|
||||||
return graphite_writers[config_name].get();
|
return graphite_writers[config_name].get();
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ std::optional<std::reference_wrapper<Daemon>> BaseDaemon::tryGetInstance()
|
|||||||
{
|
{
|
||||||
ptr = dynamic_cast<Daemon *>(&Poco::Util::Application::instance());
|
ptr = dynamic_cast<Daemon *>(&Poco::Util::Application::instance());
|
||||||
}
|
}
|
||||||
catch (const Poco::NullPointerException &)
|
catch (const Poco::NullPointerException &) /// NOLINT(bugprone-empty-catch)
|
||||||
{
|
{
|
||||||
/// if daemon doesn't exist than instance() throw NullPointerException
|
/// if daemon doesn't exist than instance() throw NullPointerException
|
||||||
}
|
}
|
||||||
|
@ -217,11 +217,13 @@ template <typename A> struct ToInteger
|
|||||||
|
|
||||||
// CLICKHOUSE-29. The same depth, different signs
|
// CLICKHOUSE-29. The same depth, different signs
|
||||||
// NOTE: This case is applied for 64-bit integers only (for backward compatibility), but could be used for any-bit integers
|
// NOTE: This case is applied for 64-bit integers only (for backward compatibility), but could be used for any-bit integers
|
||||||
|
/// NOLINTBEGIN(misc-redundant-expression)
|
||||||
template <typename A, typename B>
|
template <typename A, typename B>
|
||||||
constexpr bool LeastGreatestSpecialCase =
|
constexpr bool LeastGreatestSpecialCase =
|
||||||
std::is_integral_v<A> && std::is_integral_v<B>
|
std::is_integral_v<A> && std::is_integral_v<B>
|
||||||
&& (8 == sizeof(A) && sizeof(A) == sizeof(B))
|
&& (8 == sizeof(A) && sizeof(A) == sizeof(B))
|
||||||
&& (is_signed_v<A> ^ is_signed_v<B>);
|
&& (is_signed_v<A> ^ is_signed_v<B>);
|
||||||
|
/// NOLINTEND(misc-redundant-expression)
|
||||||
|
|
||||||
template <typename A, typename B>
|
template <typename A, typename B>
|
||||||
using ResultOfLeast = std::conditional_t<LeastGreatestSpecialCase<A, B>,
|
using ResultOfLeast = std::conditional_t<LeastGreatestSpecialCase<A, B>,
|
||||||
|
@ -18,7 +18,7 @@ public:
|
|||||||
explicit SerializationCustomSimpleText(const SerializationPtr & nested_);
|
explicit SerializationCustomSimpleText(const SerializationPtr & nested_);
|
||||||
|
|
||||||
// Methods that subclasses must override in order to get full serialization/deserialization support.
|
// 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;
|
void serializeText(const IColumn & column, size_t row_num, WriteBuffer & ostr, const FormatSettings &) const override = 0;
|
||||||
/// whole = true means that buffer contains only one value, so we should read until EOF.
|
/// whole = true means that buffer contains only one value, so we should read until EOF.
|
||||||
/// It's needed to check if there is garbage after parsed field.
|
/// It's needed to check if there is garbage after parsed field.
|
||||||
virtual void deserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings &, bool whole) const = 0;
|
virtual void deserializeText(IColumn & column, ReadBuffer & istr, const FormatSettings &, bool whole) const = 0;
|
||||||
|
@ -27,7 +27,7 @@ public:
|
|||||||
|
|
||||||
Kind getKind() const override { return Kind::SPARSE; }
|
Kind getKind() const override { return Kind::SPARSE; }
|
||||||
|
|
||||||
virtual void enumerateStreams(
|
void enumerateStreams(
|
||||||
EnumerateStreamsSettings & settings,
|
EnumerateStreamsSettings & settings,
|
||||||
const StreamCallback & callback,
|
const StreamCallback & callback,
|
||||||
const SubstreamData & data) const override;
|
const SubstreamData & data) const override;
|
||||||
|
@ -205,8 +205,8 @@ void SerializationVariantElement::removeVariantFromPath(DB::ISerialization::Subs
|
|||||||
SerializationVariantElement::VariantSubcolumnCreator::VariantSubcolumnCreator(
|
SerializationVariantElement::VariantSubcolumnCreator::VariantSubcolumnCreator(
|
||||||
const ColumnPtr & local_discriminators_,
|
const ColumnPtr & local_discriminators_,
|
||||||
const String & variant_element_name_,
|
const String & variant_element_name_,
|
||||||
const ColumnVariant::Discriminator global_variant_discriminator_,
|
ColumnVariant::Discriminator global_variant_discriminator_,
|
||||||
const ColumnVariant::Discriminator local_variant_discriminator_)
|
ColumnVariant::Discriminator local_variant_discriminator_)
|
||||||
: local_discriminators(local_discriminators_)
|
: local_discriminators(local_discriminators_)
|
||||||
, variant_element_name(variant_element_name_)
|
, variant_element_name(variant_element_name_)
|
||||||
, global_variant_discriminator(global_variant_discriminator_)
|
, global_variant_discriminator(global_variant_discriminator_)
|
||||||
|
@ -75,8 +75,8 @@ private:
|
|||||||
VariantSubcolumnCreator(
|
VariantSubcolumnCreator(
|
||||||
const ColumnPtr & local_discriminators_,
|
const ColumnPtr & local_discriminators_,
|
||||||
const String & variant_element_name_,
|
const String & variant_element_name_,
|
||||||
const ColumnVariant::Discriminator global_variant_discriminator_,
|
ColumnVariant::Discriminator global_variant_discriminator_,
|
||||||
const ColumnVariant::Discriminator local_variant_discriminator_);
|
ColumnVariant::Discriminator local_variant_discriminator_);
|
||||||
|
|
||||||
DataTypePtr create(const DataTypePtr & prev) const override;
|
DataTypePtr create(const DataTypePtr & prev) const override;
|
||||||
ColumnPtr create(const ColumnPtr & prev) const override;
|
ColumnPtr create(const ColumnPtr & prev) const override;
|
||||||
|
@ -23,7 +23,6 @@ public:
|
|||||||
|
|
||||||
String getEngineName() const override { return "Overlay"; }
|
String getEngineName() const override { return "Overlay"; }
|
||||||
|
|
||||||
public:
|
|
||||||
bool isTableExist(const String & table_name, ContextPtr context) const override;
|
bool isTableExist(const String & table_name, ContextPtr context) const override;
|
||||||
|
|
||||||
StoragePtr tryGetTable(const String & table_name, ContextPtr context) const override;
|
StoragePtr tryGetTable(const String & table_name, ContextPtr context) const override;
|
||||||
|
@ -308,7 +308,7 @@ ColumnUInt8::Ptr CacheDictionary<dictionary_key_type>::hasKeys(const Columns & k
|
|||||||
/// Write lock on storage
|
/// Write lock on storage
|
||||||
const ProfilingScopedWriteRWLock write_lock{rw_lock, ProfileEvents::DictCacheLockWriteNs};
|
const ProfilingScopedWriteRWLock write_lock{rw_lock, ProfileEvents::DictCacheLockWriteNs};
|
||||||
|
|
||||||
result_of_fetch_from_storage = cache_storage_ptr->fetchColumnsForKeys(keys, request);
|
result_of_fetch_from_storage = cache_storage_ptr->fetchColumnsForKeys(keys, request, /*default_mask*/ nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t found_keys_size = result_of_fetch_from_storage.found_keys_size;
|
size_t found_keys_size = result_of_fetch_from_storage.found_keys_size;
|
||||||
|
@ -171,7 +171,7 @@ private:
|
|||||||
const PaddedPODArray<KeyState> & key_index_to_fetched_columns_from_storage_result,
|
const PaddedPODArray<KeyState> & key_index_to_fetched_columns_from_storage_result,
|
||||||
const MutableColumns & fetched_columns_during_update,
|
const MutableColumns & fetched_columns_during_update,
|
||||||
const HashMap<KeyType, size_t> & found_keys_to_fetched_columns_during_update_index,
|
const HashMap<KeyType, size_t> & found_keys_to_fetched_columns_during_update_index,
|
||||||
IColumn::Filter * const default_mask = nullptr) const;
|
IColumn::Filter * default_mask = nullptr) const;
|
||||||
|
|
||||||
void update(CacheDictionaryUpdateUnitPtr<dictionary_key_type> update_unit_ptr);
|
void update(CacheDictionaryUpdateUnitPtr<dictionary_key_type> update_unit_ptr);
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public:
|
|||||||
SimpleKeysStorageFetchResult fetchColumnsForKeys(
|
SimpleKeysStorageFetchResult fetchColumnsForKeys(
|
||||||
const PaddedPODArray<UInt64> & keys,
|
const PaddedPODArray<UInt64> & keys,
|
||||||
const DictionaryStorageFetchRequest & fetch_request,
|
const DictionaryStorageFetchRequest & fetch_request,
|
||||||
IColumn::Filter * const default_mask = nullptr) override
|
IColumn::Filter * const default_mask) override
|
||||||
{
|
{
|
||||||
if constexpr (dictionary_key_type == DictionaryKeyType::Simple)
|
if constexpr (dictionary_key_type == DictionaryKeyType::Simple)
|
||||||
return fetchColumnsForKeysImpl<SimpleKeysStorageFetchResult>(keys, fetch_request, default_mask);
|
return fetchColumnsForKeysImpl<SimpleKeysStorageFetchResult>(keys, fetch_request, default_mask);
|
||||||
@ -110,7 +110,7 @@ public:
|
|||||||
ComplexKeysStorageFetchResult fetchColumnsForKeys(
|
ComplexKeysStorageFetchResult fetchColumnsForKeys(
|
||||||
const PaddedPODArray<StringRef> & keys,
|
const PaddedPODArray<StringRef> & keys,
|
||||||
const DictionaryStorageFetchRequest & column_fetch_requests,
|
const DictionaryStorageFetchRequest & column_fetch_requests,
|
||||||
IColumn::Filter * const default_mask = nullptr) override
|
IColumn::Filter * const default_mask) override
|
||||||
{
|
{
|
||||||
if constexpr (dictionary_key_type == DictionaryKeyType::Complex)
|
if constexpr (dictionary_key_type == DictionaryKeyType::Complex)
|
||||||
return fetchColumnsForKeysImpl<ComplexKeysStorageFetchResult>(keys, column_fetch_requests, default_mask);
|
return fetchColumnsForKeysImpl<ComplexKeysStorageFetchResult>(keys, column_fetch_requests, default_mask);
|
||||||
|
@ -82,7 +82,7 @@ public:
|
|||||||
virtual SimpleKeysStorageFetchResult fetchColumnsForKeys(
|
virtual SimpleKeysStorageFetchResult fetchColumnsForKeys(
|
||||||
const PaddedPODArray<UInt64> & keys,
|
const PaddedPODArray<UInt64> & keys,
|
||||||
const DictionaryStorageFetchRequest & fetch_request,
|
const DictionaryStorageFetchRequest & fetch_request,
|
||||||
IColumn::Filter * default_mask = nullptr) = 0;
|
IColumn::Filter * default_mask) = 0;
|
||||||
|
|
||||||
/// Fetch columns for keys, this method is not write thread safe
|
/// Fetch columns for keys, this method is not write thread safe
|
||||||
virtual void insertColumnsForKeys(const PaddedPODArray<UInt64> & keys, Columns columns) = 0;
|
virtual void insertColumnsForKeys(const PaddedPODArray<UInt64> & keys, Columns columns) = 0;
|
||||||
@ -100,7 +100,7 @@ public:
|
|||||||
virtual ComplexKeysStorageFetchResult fetchColumnsForKeys(
|
virtual ComplexKeysStorageFetchResult fetchColumnsForKeys(
|
||||||
const PaddedPODArray<StringRef> & keys,
|
const PaddedPODArray<StringRef> & keys,
|
||||||
const DictionaryStorageFetchRequest & column_fetch_requests,
|
const DictionaryStorageFetchRequest & column_fetch_requests,
|
||||||
IColumn::Filter * default_mask = nullptr) = 0;
|
IColumn::Filter * default_mask) = 0;
|
||||||
|
|
||||||
/// Fetch columns for keys, this method is not write thread safe
|
/// Fetch columns for keys, this method is not write thread safe
|
||||||
virtual void insertColumnsForKeys(const PaddedPODArray<StringRef> & keys, Columns columns) = 0;
|
virtual void insertColumnsForKeys(const PaddedPODArray<StringRef> & keys, Columns columns) = 0;
|
||||||
|
@ -288,7 +288,7 @@ private:
|
|||||||
extern template class RangeHashedDictionary<DictionaryKeyType::Simple>;
|
extern template class RangeHashedDictionary<DictionaryKeyType::Simple>;
|
||||||
extern template class RangeHashedDictionary<DictionaryKeyType::Complex>;
|
extern template class RangeHashedDictionary<DictionaryKeyType::Complex>;
|
||||||
|
|
||||||
namespace
|
namespace impl
|
||||||
{
|
{
|
||||||
template <typename F>
|
template <typename F>
|
||||||
void callOnRangeType(const DataTypePtr & range_type, F && func)
|
void callOnRangeType(const DataTypePtr & range_type, F && func)
|
||||||
@ -465,7 +465,7 @@ ColumnUInt8::Ptr RangeHashedDictionary<dictionary_key_type>::hasKeys(const Colum
|
|||||||
auto & out = result->getData();
|
auto & out = result->getData();
|
||||||
size_t keys_found = 0;
|
size_t keys_found = 0;
|
||||||
|
|
||||||
callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
impl::callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
||||||
{
|
{
|
||||||
using Types = std::decay_t<decltype(types)>;
|
using Types = std::decay_t<decltype(types)>;
|
||||||
using RangeColumnType = typename Types::LeftType;
|
using RangeColumnType = typename Types::LeftType;
|
||||||
@ -523,7 +523,7 @@ void RangeHashedDictionary<dictionary_key_type>::createAttributes()
|
|||||||
getDictionaryID().getNameForLogs());
|
getDictionaryID().getNameForLogs());
|
||||||
}
|
}
|
||||||
|
|
||||||
callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
impl::callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
||||||
{
|
{
|
||||||
using Types = std::decay_t<decltype(types)>;
|
using Types = std::decay_t<decltype(types)>;
|
||||||
using RangeColumnType = typename Types::LeftType;
|
using RangeColumnType = typename Types::LeftType;
|
||||||
@ -553,7 +553,7 @@ void RangeHashedDictionary<dictionary_key_type>::loadData()
|
|||||||
updateData();
|
updateData();
|
||||||
}
|
}
|
||||||
|
|
||||||
callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
impl::callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
||||||
{
|
{
|
||||||
using Types = std::decay_t<decltype(types)>;
|
using Types = std::decay_t<decltype(types)>;
|
||||||
using RangeColumnType = typename Types::LeftType;
|
using RangeColumnType = typename Types::LeftType;
|
||||||
@ -573,7 +573,7 @@ void RangeHashedDictionary<dictionary_key_type>::loadData()
|
|||||||
template <DictionaryKeyType dictionary_key_type>
|
template <DictionaryKeyType dictionary_key_type>
|
||||||
void RangeHashedDictionary<dictionary_key_type>::calculateBytesAllocated()
|
void RangeHashedDictionary<dictionary_key_type>::calculateBytesAllocated()
|
||||||
{
|
{
|
||||||
callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
impl::callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
||||||
{
|
{
|
||||||
using Types = std::decay_t<decltype(types)>;
|
using Types = std::decay_t<decltype(types)>;
|
||||||
using RangeColumnType = typename Types::LeftType;
|
using RangeColumnType = typename Types::LeftType;
|
||||||
@ -783,7 +783,7 @@ void RangeHashedDictionary<dictionary_key_type>::blockToAttributes(const Block &
|
|||||||
max_range_null_map = &max_range_column_nullable->getNullMapColumn().getData();
|
max_range_null_map = &max_range_column_nullable->getNullMapColumn().getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
impl::callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
||||||
{
|
{
|
||||||
using Types = std::decay_t<decltype(types)>;
|
using Types = std::decay_t<decltype(types)>;
|
||||||
using RangeColumnType = typename Types::LeftType;
|
using RangeColumnType = typename Types::LeftType;
|
||||||
@ -930,7 +930,7 @@ Pipe RangeHashedDictionary<dictionary_key_type>::read(const Names & column_names
|
|||||||
|
|
||||||
PaddedPODArray<KeyType> keys;
|
PaddedPODArray<KeyType> keys;
|
||||||
|
|
||||||
callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
impl::callOnRangeType(dict_struct.range_min->type, [&](const auto & types)
|
||||||
{
|
{
|
||||||
using Types = std::decay_t<decltype(types)>;
|
using Types = std::decay_t<decltype(types)>;
|
||||||
using RangeColumnType = typename Types::LeftType;
|
using RangeColumnType = typename Types::LeftType;
|
||||||
|
@ -37,7 +37,7 @@ void RangeHashedDictionary<dictionary_key_type>::getItemsImpl(
|
|||||||
DictionaryKeysExtractor<dictionary_key_type> keys_extractor(key_columns_copy, arena_holder.getComplexKeyArena());
|
DictionaryKeysExtractor<dictionary_key_type> keys_extractor(key_columns_copy, arena_holder.getComplexKeyArena());
|
||||||
const size_t keys_size = keys_extractor.getKeysSize();
|
const size_t keys_size = keys_extractor.getKeysSize();
|
||||||
|
|
||||||
callOnRangeType(
|
impl::callOnRangeType(
|
||||||
dict_struct.range_min->type,
|
dict_struct.range_min->type,
|
||||||
[&](const auto & types)
|
[&](const auto & types)
|
||||||
{
|
{
|
||||||
|
@ -37,7 +37,7 @@ size_t RangeHashedDictionary<dictionary_key_type>::getItemsShortCircuitImpl(
|
|||||||
const size_t keys_size = keys_extractor.getKeysSize();
|
const size_t keys_size = keys_extractor.getKeysSize();
|
||||||
default_mask.resize(keys_size);
|
default_mask.resize(keys_size);
|
||||||
|
|
||||||
callOnRangeType(
|
impl::callOnRangeType(
|
||||||
dict_struct.range_min->type,
|
dict_struct.range_min->type,
|
||||||
[&](const auto & types)
|
[&](const auto & types)
|
||||||
{
|
{
|
||||||
|
@ -870,7 +870,7 @@ public:
|
|||||||
SimpleKeysStorageFetchResult fetchColumnsForKeys(
|
SimpleKeysStorageFetchResult fetchColumnsForKeys(
|
||||||
const PaddedPODArray<UInt64> & keys,
|
const PaddedPODArray<UInt64> & keys,
|
||||||
const DictionaryStorageFetchRequest & fetch_request,
|
const DictionaryStorageFetchRequest & fetch_request,
|
||||||
IColumn::Filter * const default_mask = nullptr) override
|
IColumn::Filter * const default_mask) override
|
||||||
{
|
{
|
||||||
if constexpr (dictionary_key_type == DictionaryKeyType::Simple)
|
if constexpr (dictionary_key_type == DictionaryKeyType::Simple)
|
||||||
return fetchColumnsForKeysImpl<SimpleKeysStorageFetchResult>(keys, fetch_request, default_mask);
|
return fetchColumnsForKeysImpl<SimpleKeysStorageFetchResult>(keys, fetch_request, default_mask);
|
||||||
@ -907,7 +907,7 @@ public:
|
|||||||
ComplexKeysStorageFetchResult fetchColumnsForKeys(
|
ComplexKeysStorageFetchResult fetchColumnsForKeys(
|
||||||
const PaddedPODArray<StringRef> & keys,
|
const PaddedPODArray<StringRef> & keys,
|
||||||
const DictionaryStorageFetchRequest & fetch_request,
|
const DictionaryStorageFetchRequest & fetch_request,
|
||||||
IColumn::Filter * const default_mask = nullptr) override
|
IColumn::Filter * const default_mask) override
|
||||||
{
|
{
|
||||||
if constexpr (dictionary_key_type == DictionaryKeyType::Complex)
|
if constexpr (dictionary_key_type == DictionaryKeyType::Complex)
|
||||||
return fetchColumnsForKeysImpl<ComplexKeysStorageFetchResult>(keys, fetch_request, default_mask);
|
return fetchColumnsForKeysImpl<ComplexKeysStorageFetchResult>(keys, fetch_request, default_mask);
|
||||||
|
@ -62,8 +62,8 @@ public:
|
|||||||
virtual void copyFile(
|
virtual void copyFile(
|
||||||
const std::string & from_file_path,
|
const std::string & from_file_path,
|
||||||
const std::string & to_file_path,
|
const std::string & to_file_path,
|
||||||
const ReadSettings & read_settings = {},
|
const ReadSettings & read_settings,
|
||||||
const WriteSettings & write_settings = {}) = 0;
|
const WriteSettings & write_settings) = 0;
|
||||||
|
|
||||||
/// Open the file for write and return WriteBufferFromFileBase object.
|
/// Open the file for write and return WriteBufferFromFileBase object.
|
||||||
virtual std::unique_ptr<WriteBufferFromFileBase> writeFile( /// NOLINT
|
virtual std::unique_ptr<WriteBufferFromFileBase> writeFile( /// NOLINT
|
||||||
|
@ -78,7 +78,7 @@ private:
|
|||||||
public:
|
public:
|
||||||
explicit IOUringReader(uint32_t entries_);
|
explicit IOUringReader(uint32_t entries_);
|
||||||
|
|
||||||
inline bool isSupported() { return is_supported; }
|
bool isSupported() const { return is_supported; }
|
||||||
std::future<Result> submit(Request request) override;
|
std::future<Result> submit(Request request) override;
|
||||||
Result execute(Request /* request */) override { throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Method `execute` not implemented for IOUringReader"); }
|
Result execute(Request /* request */) override { throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Method `execute` not implemented for IOUringReader"); }
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ public:
|
|||||||
DiskSelectorPtr disk_selector
|
DiskSelectorPtr disk_selector
|
||||||
);
|
);
|
||||||
|
|
||||||
virtual ReservationPtr reserve(UInt64 bytes) override = 0;
|
ReservationPtr reserve(UInt64 bytes) override = 0;
|
||||||
|
|
||||||
/// This is a volume.
|
/// This is a volume.
|
||||||
bool isVolume() const override { return true; }
|
bool isVolume() const override { return true; }
|
||||||
|
@ -204,7 +204,7 @@ void DiskObjectStorage::copyFile( /// NOLINT
|
|||||||
/// It may use s3-server-side copy
|
/// It may use s3-server-side copy
|
||||||
auto & to_disk_object_storage = dynamic_cast<DiskObjectStorage &>(to_disk);
|
auto & to_disk_object_storage = dynamic_cast<DiskObjectStorage &>(to_disk);
|
||||||
auto transaction = createObjectStorageTransactionToAnotherDisk(to_disk_object_storage);
|
auto transaction = createObjectStorageTransactionToAnotherDisk(to_disk_object_storage);
|
||||||
transaction->copyFile(from_file_path, to_file_path);
|
transaction->copyFile(from_file_path, to_file_path, /*read_settings*/ {}, /*write_settings*/ {});
|
||||||
transaction->commit();
|
transaction->commit();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -54,7 +54,7 @@ public:
|
|||||||
return batch;
|
return batch;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual std::optional<RelativePathsWithMetadata> getCurrrentBatchAndScheduleNext() override
|
std::optional<RelativePathsWithMetadata> getCurrrentBatchAndScheduleNext() override
|
||||||
{
|
{
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
@ -9,14 +9,6 @@
|
|||||||
|
|
||||||
#include <IO/S3/Client.h>
|
#include <IO/S3/Client.h>
|
||||||
|
|
||||||
namespace Aws
|
|
||||||
{
|
|
||||||
namespace S3
|
|
||||||
{
|
|
||||||
class Client;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace DB
|
namespace DB
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ struct CountSubstringsImpl
|
|||||||
const UInt8 * pos = begin;
|
const UInt8 * pos = begin;
|
||||||
|
|
||||||
/// FIXME: suboptimal
|
/// FIXME: suboptimal
|
||||||
memset(&res[0], 0, res.size() * sizeof(res[0]));
|
memset(&res[0], 0, res.size() * sizeof(res[0])); /// NOLINT(readability-container-data-pointer)
|
||||||
|
|
||||||
if (needle.empty())
|
if (needle.empty())
|
||||||
return; // Return all zeros
|
return; // Return all zeros
|
||||||
|
@ -58,7 +58,7 @@ struct CustomWeekTransformImpl
|
|||||||
template <typename Transform>
|
template <typename Transform>
|
||||||
static ColumnPtr execute(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t /*input_rows_count*/, Transform transform = {})
|
static ColumnPtr execute(const ColumnsWithTypeAndName & arguments, const DataTypePtr &, size_t /*input_rows_count*/, Transform transform = {})
|
||||||
{
|
{
|
||||||
const auto op = WeekTransformer<typename FromDataType::FieldType, typename ToDataType::FieldType, Transform, is_extended_result>{std::move(transform)};
|
const auto op = WeekTransformer<typename FromDataType::FieldType, typename ToDataType::FieldType, Transform, is_extended_result>{transform};
|
||||||
|
|
||||||
static constexpr UInt8 default_week_mode = 0;
|
static constexpr UInt8 default_week_mode = 0;
|
||||||
UInt8 week_mode = default_week_mode;
|
UInt8 week_mode = default_week_mode;
|
||||||
|
@ -13,8 +13,9 @@ class FunctionConstantBase : public IFunction
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template <typename U>
|
template <typename U>
|
||||||
explicit FunctionConstantBase(U && constant_value_, bool is_distributed_ = false)
|
explicit FunctionConstantBase(const U & constant_value_, bool is_distributed_ = false)
|
||||||
: constant_value(static_cast<T>(std::forward<U>(constant_value_))), is_distributed(is_distributed_)
|
: constant_value(static_cast<T>(constant_value_))
|
||||||
|
, is_distributed(is_distributed_)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ inline void validateCipherMode(const EVP_CIPHER * evp_cipher)
|
|||||||
{
|
{
|
||||||
if constexpr (compatibility_mode == CompatibilityMode::MySQL)
|
if constexpr (compatibility_mode == CompatibilityMode::MySQL)
|
||||||
{
|
{
|
||||||
switch (EVP_CIPHER_mode(evp_cipher))
|
switch (EVP_CIPHER_mode(evp_cipher)) /// NOLINT(bugprone-switch-missing-default-case)
|
||||||
{
|
{
|
||||||
case EVP_CIPH_ECB_MODE: [[fallthrough]];
|
case EVP_CIPH_ECB_MODE: [[fallthrough]];
|
||||||
case EVP_CIPH_CBC_MODE: [[fallthrough]];
|
case EVP_CIPH_CBC_MODE: [[fallthrough]];
|
||||||
@ -107,7 +107,7 @@ inline void validateCipherMode(const EVP_CIPHER * evp_cipher)
|
|||||||
}
|
}
|
||||||
else if constexpr (compatibility_mode == CompatibilityMode::OpenSSL)
|
else if constexpr (compatibility_mode == CompatibilityMode::OpenSSL)
|
||||||
{
|
{
|
||||||
switch (EVP_CIPHER_mode(evp_cipher))
|
switch (EVP_CIPHER_mode(evp_cipher)) /// NOLINT(bugprone-switch-missing-default-case)
|
||||||
{
|
{
|
||||||
case EVP_CIPH_ECB_MODE: [[fallthrough]];
|
case EVP_CIPH_ECB_MODE: [[fallthrough]];
|
||||||
case EVP_CIPH_CBC_MODE: [[fallthrough]];
|
case EVP_CIPH_CBC_MODE: [[fallthrough]];
|
||||||
|
@ -519,12 +519,12 @@ public:
|
|||||||
"but one of them has type {}.", getName(), arguments[i + 1]->getName());
|
"but one of them has type {}.", getName(), arguments[i + 1]->getName());
|
||||||
|
|
||||||
if (!array_type)
|
if (!array_type)
|
||||||
throw exception;
|
throw exception; /// NOLINT
|
||||||
|
|
||||||
auto nested_type = array_type->getNestedType();
|
auto nested_type = array_type->getNestedType();
|
||||||
WhichDataType which(nested_type);
|
WhichDataType which(nested_type);
|
||||||
if (!(which.isUInt8() || which.isUInt16() || which.isUInt32() || which.isUInt64()))
|
if (!(which.isUInt8() || which.isUInt16() || which.isUInt32() || which.isUInt64()))
|
||||||
throw exception;
|
throw exception; /// NOLINT
|
||||||
}
|
}
|
||||||
return arguments[0];
|
return arguments[0];
|
||||||
}
|
}
|
||||||
|
@ -283,7 +283,7 @@ struct StringComparisonImpl
|
|||||||
size_t size = a_data.size();
|
size_t size = a_data.size();
|
||||||
|
|
||||||
for (size_t i = 0, j = 0; i < size; i += 16, ++j)
|
for (size_t i = 0, j = 0; i < size; i += 16, ++j)
|
||||||
c[j] = Op::apply(memcmp16(&a_data[i], &b_data[0]), 0);
|
c[j] = Op::apply(memcmp16(&a_data[i], &b_data[0]), 0); /// NOLINT(readability-container-data-pointer)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void NO_INLINE fixed_string_vector_fixed_string_vector( /// NOLINT
|
static void NO_INLINE fixed_string_vector_fixed_string_vector( /// NOLINT
|
||||||
|
@ -393,8 +393,8 @@ public:
|
|||||||
throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "Function {} does not support nullable keys", getName());
|
throw Exception(ErrorCodes::UNSUPPORTED_METHOD, "Function {} does not support nullable keys", getName());
|
||||||
|
|
||||||
// Wrap all the attribute types in Array()
|
// Wrap all the attribute types in Array()
|
||||||
for (auto it = attribute_types.begin(); it != attribute_types.end(); ++it)
|
for (auto & attr_type : attribute_types)
|
||||||
*it = std::make_shared<DataTypeArray>(*it);
|
attr_type = std::make_shared<DataTypeArray>(attr_type);
|
||||||
}
|
}
|
||||||
if (attribute_types.size() > 1)
|
if (attribute_types.size() > 1)
|
||||||
{
|
{
|
||||||
|
@ -190,14 +190,26 @@ public:
|
|||||||
{
|
{
|
||||||
if (col_haystack_const && col_needle_const)
|
if (col_haystack_const && col_needle_const)
|
||||||
{
|
{
|
||||||
const auto is_col_start_pos_const = !column_start_pos || isColumnConst(*column_start_pos);
|
auto column_start_position_arg = column_start_pos;
|
||||||
|
bool is_col_start_pos_const = false;
|
||||||
|
if (column_start_pos)
|
||||||
|
{
|
||||||
|
if (const ColumnConst * const_column_start_pos = typeid_cast<const ColumnConst *>(&*column_start_pos))
|
||||||
|
{
|
||||||
|
is_col_start_pos_const = true;
|
||||||
|
column_start_position_arg = const_column_start_pos->getDataColumnPtr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
is_col_start_pos_const = true;
|
||||||
|
|
||||||
vec_res.resize(is_col_start_pos_const ? 1 : column_start_pos->size());
|
vec_res.resize(is_col_start_pos_const ? 1 : column_start_pos->size());
|
||||||
const auto null_map = create_null_map();
|
const auto null_map = create_null_map();
|
||||||
|
|
||||||
Impl::constantConstant(
|
Impl::constantConstant(
|
||||||
col_haystack_const->getValue<String>(),
|
col_haystack_const->getValue<String>(),
|
||||||
col_needle_const->getValue<String>(),
|
col_needle_const->getValue<String>(),
|
||||||
column_start_pos,
|
column_start_position_arg,
|
||||||
vec_res,
|
vec_res,
|
||||||
null_map.get());
|
null_map.get());
|
||||||
|
|
||||||
|
@ -73,6 +73,8 @@ struct ToStartOfTransform;
|
|||||||
TRANSFORM_TIME(Second)
|
TRANSFORM_TIME(Second)
|
||||||
#undef TRANSFORM_TIME
|
#undef TRANSFORM_TIME
|
||||||
|
|
||||||
|
/// NOLINTBEGIN(bugprone-macro-parentheses)
|
||||||
|
|
||||||
#define TRANSFORM_SUBSECONDS(INTERVAL_KIND, DEF_SCALE) \
|
#define TRANSFORM_SUBSECONDS(INTERVAL_KIND, DEF_SCALE) \
|
||||||
template<> \
|
template<> \
|
||||||
struct ToStartOfTransform<IntervalKind::Kind::INTERVAL_KIND> \
|
struct ToStartOfTransform<IntervalKind::Kind::INTERVAL_KIND> \
|
||||||
@ -156,6 +158,8 @@ template <> \
|
|||||||
ADD_SUBSECONDS(Nanosecond, 9)
|
ADD_SUBSECONDS(Nanosecond, 9)
|
||||||
#undef ADD_SUBSECONDS
|
#undef ADD_SUBSECONDS
|
||||||
|
|
||||||
|
/// NOLINTEND(bugprone-macro-parentheses)
|
||||||
|
|
||||||
template <TimeWindowFunctionName type>
|
template <TimeWindowFunctionName type>
|
||||||
struct TimeWindowImpl
|
struct TimeWindowImpl
|
||||||
{
|
{
|
||||||
|
@ -126,19 +126,19 @@ struct ArrayAndValueSourceSelectorBySink : public ArraySinkSelector<ArrayAndValu
|
|||||||
template <typename Sink, typename ... Args>
|
template <typename Sink, typename ... Args>
|
||||||
static void selectImpl(Sink && sink, IArraySource & array_source, IValueSource & value_source, Args && ... args)
|
static void selectImpl(Sink && sink, IArraySource & array_source, IValueSource & value_source, Args && ... args)
|
||||||
{
|
{
|
||||||
using SynkType = typename std::decay<Sink>::type;
|
using SinkType = typename std::decay_t<Sink>;
|
||||||
using ArraySource = typename SynkType::CompatibleArraySource;
|
using ArraySource = typename SinkType::CompatibleArraySource;
|
||||||
using ValueSource = typename SynkType::CompatibleValueSource;
|
using ValueSource = typename SinkType::CompatibleValueSource;
|
||||||
|
|
||||||
auto check_type = [] (auto source_ptr)
|
auto check_type = [] (auto source_ptr)
|
||||||
{
|
{
|
||||||
if (source_ptr == nullptr)
|
if (source_ptr == nullptr)
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "{} expected {} or {} or {} or {} but got {}",
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "{} expected {} or {} or {} or {} but got {}",
|
||||||
demangle(typeid(Base).name()),
|
demangle(typeid(Base).name()),
|
||||||
demangle(typeid(typename SynkType::CompatibleArraySource).name()),
|
demangle(typeid(typename SinkType::CompatibleArraySource).name()),
|
||||||
demangle(typeid(ConstSource<typename SynkType::CompatibleArraySource>).name()),
|
demangle(typeid(ConstSource<typename SinkType::CompatibleArraySource>).name()),
|
||||||
demangle(typeid(typename SynkType::CompatibleValueSource).name()),
|
demangle(typeid(typename SinkType::CompatibleValueSource).name()),
|
||||||
demangle(typeid(ConstSource<typename SynkType::CompatibleValueSource>).name()),
|
demangle(typeid(ConstSource<typename SinkType::CompatibleValueSource>).name()),
|
||||||
demangle(typeid(*source_ptr).name()));
|
demangle(typeid(*source_ptr).name()));
|
||||||
};
|
};
|
||||||
auto check_type_and_call_concat = [& sink, & check_type, & args ...] (auto array_source_ptr, auto value_source_ptr)
|
auto check_type_and_call_concat = [& sink, & check_type, & args ...] (auto array_source_ptr, auto value_source_ptr)
|
||||||
|
@ -144,6 +144,8 @@ struct NumericArraySource : public ArraySourceImpl<NumericArraySource<T>>
|
|||||||
#pragma clang diagnostic ignored "-Wsuggest-override"
|
#pragma clang diagnostic ignored "-Wsuggest-override"
|
||||||
#pragma clang diagnostic ignored "-Wsuggest-destructor-override"
|
#pragma clang diagnostic ignored "-Wsuggest-destructor-override"
|
||||||
|
|
||||||
|
/// NOLINTBEGIN(hicpp-use-override)
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct ConstSource : public Base
|
struct ConstSource : public Base
|
||||||
{
|
{
|
||||||
@ -231,6 +233,8 @@ struct ConstSource : public Base
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// NOLINTEND(hicpp-use-override)
|
||||||
|
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
struct StringSource
|
struct StringSource
|
||||||
|
@ -13,7 +13,7 @@ class WriteBuffer;
|
|||||||
class GregorianDate
|
class GregorianDate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GregorianDate() {}
|
GregorianDate() = default;
|
||||||
|
|
||||||
void init(ReadBuffer & in);
|
void init(ReadBuffer & in);
|
||||||
bool tryInit(ReadBuffer & in);
|
bool tryInit(ReadBuffer & in);
|
||||||
@ -84,7 +84,7 @@ private:
|
|||||||
class OrdinalDate
|
class OrdinalDate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OrdinalDate() {}
|
OrdinalDate() = default;
|
||||||
|
|
||||||
void init(int32_t year, uint16_t day_of_year);
|
void init(int32_t year, uint16_t day_of_year);
|
||||||
bool tryInit(int32_t year, uint16_t day_of_year);
|
bool tryInit(int32_t year, uint16_t day_of_year);
|
||||||
|
@ -14,8 +14,6 @@ namespace ErrorCodes
|
|||||||
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
||||||
extern const int ILLEGAL_COLUMN;
|
extern const int ILLEGAL_COLUMN;
|
||||||
}
|
}
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
using namespace GatherUtils;
|
using namespace GatherUtils;
|
||||||
|
|
||||||
@ -154,5 +152,3 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -35,7 +35,7 @@ public:
|
|||||||
}
|
}
|
||||||
const auto * query = path->jsonpath_query;
|
const auto * query = path->jsonpath_query;
|
||||||
|
|
||||||
for (auto child_ast : query->children)
|
for (const auto & child_ast : query->children)
|
||||||
{
|
{
|
||||||
if (typeid_cast<ASTJSONPathRoot *>(child_ast.get()))
|
if (typeid_cast<ASTJSONPathRoot *>(child_ast.get()))
|
||||||
{
|
{
|
||||||
|
@ -174,7 +174,7 @@ private:
|
|||||||
|
|
||||||
static void array(const UInt8 * src, const UInt8 * src_end, const ColumnString::Offsets & offsets, UInt8 * dst)
|
static void array(const UInt8 * src, const UInt8 * src_end, const ColumnString::Offsets & offsets, UInt8 * dst)
|
||||||
{
|
{
|
||||||
auto offset_it = offsets.begin();
|
const auto * offset_it = offsets.begin();
|
||||||
const UInt8 * begin = src;
|
const UInt8 * begin = src;
|
||||||
|
|
||||||
#ifdef __SSE2__
|
#ifdef __SSE2__
|
||||||
|
@ -88,7 +88,7 @@ exloop: if ((scheme_end - pos) > 2 && *pos == ':' && *(pos + 1) == '/' && *(pos
|
|||||||
const auto * start_of_host = pos;
|
const auto * start_of_host = pos;
|
||||||
for (; pos < end; ++pos)
|
for (; pos < end; ++pos)
|
||||||
{
|
{
|
||||||
switch (*pos)
|
switch (*pos) /// NOLINT(bugprone-switch-missing-default-case)
|
||||||
{
|
{
|
||||||
case '.':
|
case '.':
|
||||||
if (has_open_bracket)
|
if (has_open_bracket)
|
||||||
@ -220,7 +220,7 @@ exloop: if ((scheme_end - pos) > 2 && *pos == ':' && *(pos + 1) == '/' && *(pos
|
|||||||
const auto * start_of_host = pos;
|
const auto * start_of_host = pos;
|
||||||
for (; pos < end; ++pos)
|
for (; pos < end; ++pos)
|
||||||
{
|
{
|
||||||
switch (*pos)
|
switch (*pos) /// NOLINT(bugprone-switch-missing-default-case)
|
||||||
{
|
{
|
||||||
case '.':
|
case '.':
|
||||||
dot_pos = pos;
|
dot_pos = pos;
|
||||||
|
@ -137,8 +137,8 @@ namespace DB
|
|||||||
|
|
||||||
for (size_t i = 0; i < input_rows_count; ++i)
|
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 AggregateDataPtr data_ptr_1 = is_column_const[1] ? container1[0] : container1[i];
|
AggregateDataPtr data_ptr_1 = is_column_const[1] ? container1[0] : container1[i];
|
||||||
|
|
||||||
col_to->insertFrom(data_ptr_0);
|
col_to->insertFrom(data_ptr_0);
|
||||||
AggregateFunctionUniqThetaData & sketch_data_1 = *reinterpret_cast<AggregateFunctionUniqThetaData *>(col_to->getData()[i]);
|
AggregateFunctionUniqThetaData & sketch_data_1 = *reinterpret_cast<AggregateFunctionUniqThetaData *>(col_to->getData()[i]);
|
||||||
|
@ -88,7 +88,7 @@ restoreUserDefinedSQLObjects(RestorerFromBackup & restorer, const String & data_
|
|||||||
auto backup = restorer.getBackup();
|
auto backup = restorer.getBackup();
|
||||||
fs::path data_path_in_backup_fs{data_path_in_backup};
|
fs::path data_path_in_backup_fs{data_path_in_backup};
|
||||||
|
|
||||||
Strings filenames = backup->listFiles(data_path_in_backup);
|
Strings filenames = backup->listFiles(data_path_in_backup, /*recursive*/ false);
|
||||||
if (filenames.empty())
|
if (filenames.empty())
|
||||||
return {}; /// Nothing to restore.
|
return {}; /// Nothing to restore.
|
||||||
|
|
||||||
|
@ -28,9 +28,6 @@ namespace ErrorCodes
|
|||||||
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
extern const int ILLEGAL_TYPE_OF_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace
|
|
||||||
{
|
|
||||||
|
|
||||||
template <typename Point>
|
template <typename Point>
|
||||||
using Ring = boost::geometry::model::ring<Point>;
|
using Ring = boost::geometry::model::ring<Point>;
|
||||||
|
|
||||||
@ -374,5 +371,3 @@ static void callOnTwoGeometryDataTypes(DataTypePtr left_type, DataTypePtr right_
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -44,7 +44,7 @@ struct RepeatImpl
|
|||||||
ColumnString::Offsets & res_offsets,
|
ColumnString::Offsets & res_offsets,
|
||||||
T repeat_time)
|
T repeat_time)
|
||||||
{
|
{
|
||||||
repeat_time = repeat_time < 0 ? 0 : repeat_time;
|
repeat_time = repeat_time < 0 ? static_cast<T>(0) : repeat_time;
|
||||||
checkRepeatTime(repeat_time);
|
checkRepeatTime(repeat_time);
|
||||||
|
|
||||||
UInt64 data_size = 0;
|
UInt64 data_size = 0;
|
||||||
@ -76,7 +76,7 @@ struct RepeatImpl
|
|||||||
res_offsets.assign(offsets);
|
res_offsets.assign(offsets);
|
||||||
for (UInt64 i = 0; i < col_num.size(); ++i)
|
for (UInt64 i = 0; i < col_num.size(); ++i)
|
||||||
{
|
{
|
||||||
T repeat_time = col_num[i] < 0 ? 0 : col_num[i];
|
T repeat_time = col_num[i] < 0 ? static_cast<T>(0) : col_num[i];
|
||||||
size_t repeated_size = (offsets[i] - offsets[i - 1] - 1) * repeat_time + 1;
|
size_t repeated_size = (offsets[i] - offsets[i - 1] - 1) * repeat_time + 1;
|
||||||
checkStringSize(repeated_size);
|
checkStringSize(repeated_size);
|
||||||
data_size += repeated_size;
|
data_size += repeated_size;
|
||||||
@ -86,7 +86,7 @@ struct RepeatImpl
|
|||||||
|
|
||||||
for (UInt64 i = 0; i < col_num.size(); ++i)
|
for (UInt64 i = 0; i < col_num.size(); ++i)
|
||||||
{
|
{
|
||||||
T repeat_time = col_num[i] < 0 ? 0 : col_num[i];
|
T repeat_time = col_num[i] < 0 ? static_cast<T>(0) : col_num[i];
|
||||||
checkRepeatTime(repeat_time);
|
checkRepeatTime(repeat_time);
|
||||||
process(data.data() + offsets[i - 1], res_data.data() + res_offsets[i - 1], offsets[i] - offsets[i - 1], repeat_time);
|
process(data.data() + offsets[i - 1], res_data.data() + res_offsets[i - 1], offsets[i] - offsets[i - 1], repeat_time);
|
||||||
}
|
}
|
||||||
@ -105,7 +105,7 @@ struct RepeatImpl
|
|||||||
UInt64 col_size = col_num.size();
|
UInt64 col_size = col_num.size();
|
||||||
for (UInt64 i = 0; i < col_size; ++i)
|
for (UInt64 i = 0; i < col_size; ++i)
|
||||||
{
|
{
|
||||||
T repeat_time = col_num[i] < 0 ? 0 : col_num[i];
|
T repeat_time = col_num[i] < 0 ? static_cast<T>(0) : col_num[i];
|
||||||
size_t repeated_size = str_size * repeat_time + 1;
|
size_t repeated_size = str_size * repeat_time + 1;
|
||||||
checkStringSize(repeated_size);
|
checkStringSize(repeated_size);
|
||||||
data_size += repeated_size;
|
data_size += repeated_size;
|
||||||
@ -114,7 +114,7 @@ struct RepeatImpl
|
|||||||
res_data.resize(data_size);
|
res_data.resize(data_size);
|
||||||
for (UInt64 i = 0; i < col_size; ++i)
|
for (UInt64 i = 0; i < col_size; ++i)
|
||||||
{
|
{
|
||||||
T repeat_time = col_num[i] < 0 ? 0 : col_num[i];
|
T repeat_time = col_num[i] < 0 ? static_cast<T>(0) : col_num[i];
|
||||||
checkRepeatTime(repeat_time);
|
checkRepeatTime(repeat_time);
|
||||||
process(
|
process(
|
||||||
reinterpret_cast<UInt8 *>(const_cast<char *>(copy_str.data())),
|
reinterpret_cast<UInt8 *>(const_cast<char *>(copy_str.data())),
|
||||||
@ -169,8 +169,19 @@ class FunctionRepeat : public IFunction
|
|||||||
template <typename F>
|
template <typename F>
|
||||||
static bool castType(const IDataType * type, F && f)
|
static bool castType(const IDataType * type, F && f)
|
||||||
{
|
{
|
||||||
return castTypeToEither<DataTypeInt8, DataTypeInt16, DataTypeInt32, DataTypeInt64,
|
return castTypeToEither<
|
||||||
DataTypeUInt8, DataTypeUInt16, DataTypeUInt32, DataTypeUInt64>(type, std::forward<F>(f));
|
DataTypeInt8,
|
||||||
|
DataTypeInt16,
|
||||||
|
DataTypeInt32,
|
||||||
|
DataTypeInt64,
|
||||||
|
DataTypeInt128,
|
||||||
|
DataTypeInt256,
|
||||||
|
DataTypeUInt8,
|
||||||
|
DataTypeUInt16,
|
||||||
|
DataTypeUInt32,
|
||||||
|
DataTypeUInt64,
|
||||||
|
DataTypeUInt128,
|
||||||
|
DataTypeUInt256>(type, std::forward<F>(f));
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -208,7 +219,7 @@ public:
|
|||||||
if (const ColumnConst * col_num_const = checkAndGetColumn<ColumnConst>(col_num.get()))
|
if (const ColumnConst * col_num_const = checkAndGetColumn<ColumnConst>(col_num.get()))
|
||||||
{
|
{
|
||||||
auto col_res = ColumnString::create();
|
auto col_res = ColumnString::create();
|
||||||
castType(arguments[1].type.get(), [&](const auto & type)
|
auto success = castType(arguments[1].type.get(), [&](const auto & type)
|
||||||
{
|
{
|
||||||
using DataType = std::decay_t<decltype(type)>;
|
using DataType = std::decay_t<decltype(type)>;
|
||||||
using T = typename DataType::FieldType;
|
using T = typename DataType::FieldType;
|
||||||
@ -216,6 +227,11 @@ public:
|
|||||||
RepeatImpl::vectorStrConstRepeat(col->getChars(), col->getOffsets(), col_res->getChars(), col_res->getOffsets(), times);
|
RepeatImpl::vectorStrConstRepeat(col->getChars(), col->getOffsets(), col_res->getChars(), col_res->getOffsets(), times);
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!success)
|
||||||
|
throw Exception(ErrorCodes::ILLEGAL_COLUMN, "Illegal column type {} of 'n' of function {}",
|
||||||
|
arguments[1].column->getName(), getName());
|
||||||
|
|
||||||
return col_res;
|
return col_res;
|
||||||
}
|
}
|
||||||
else if (castType(arguments[1].type.get(), [&](const auto & type)
|
else if (castType(arguments[1].type.get(), [&](const auto & type)
|
||||||
|
@ -24,12 +24,12 @@
|
|||||||
|
|
||||||
namespace stl {
|
namespace stl {
|
||||||
|
|
||||||
bool est(const float* y, size_t n, size_t len, int ideg, float xs, float* ys, size_t nleft, size_t nright, float* w, bool userw, const float* rw) {
|
inline bool est(const float* y, size_t n, size_t len, int ideg, float xs, float* ys, size_t nleft, size_t nright, float* w, bool userw, const float* rw) {
|
||||||
auto range = ((float) n) - 1.0;
|
auto range = ((float) n) - 1.0;
|
||||||
auto h = std::max(xs - ((float) nleft), ((float) nright) - xs);
|
auto h = std::max(xs - ((float) nleft), ((float) nright) - xs);
|
||||||
|
|
||||||
if (len > n) {
|
if (len > n) {
|
||||||
h += (float) ((len - n) / 2);
|
h += (float) ((len - n) / 2); /// NOLINT(bugprone-integer-division)
|
||||||
}
|
}
|
||||||
|
|
||||||
auto h9 = 0.999 * h;
|
auto h9 = 0.999 * h;
|
||||||
@ -89,7 +89,7 @@ bool est(const float* y, size_t n, size_t len, int ideg, float xs, float* ys, si
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ess(const float* y, size_t n, size_t len, int ideg, size_t njump, bool userw, const float* rw, float* ys, float* res) {
|
inline void ess(const float* y, size_t n, size_t len, int ideg, size_t njump, bool userw, const float* rw, float* ys, float* res) {
|
||||||
if (n < 2) {
|
if (n < 2) {
|
||||||
ys[0] = y[0];
|
ys[0] = y[0];
|
||||||
return;
|
return;
|
||||||
@ -165,7 +165,7 @@ void ess(const float* y, size_t n, size_t len, int ideg, size_t njump, bool user
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ma(const float* x, size_t n, size_t len, float* ave) {
|
inline void ma(const float* x, size_t n, size_t len, float* ave) {
|
||||||
auto newn = n - len + 1;
|
auto newn = n - len + 1;
|
||||||
auto flen = (float) len;
|
auto flen = (float) len;
|
||||||
auto v = 0.0;
|
auto v = 0.0;
|
||||||
@ -189,13 +189,13 @@ void ma(const float* x, size_t n, size_t len, float* ave) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void fts(const float* x, size_t n, size_t np, float* trend, float* work) {
|
inline void fts(const float* x, size_t n, size_t np, float* trend, float* work) {
|
||||||
ma(x, n, np, trend);
|
ma(x, n, np, trend);
|
||||||
ma(trend, n - np + 1, np, work);
|
ma(trend, n - np + 1, np, work);
|
||||||
ma(work, n - 2 * np + 2, 3, trend);
|
ma(work, n - 2 * np + 2, 3, trend);
|
||||||
}
|
}
|
||||||
|
|
||||||
void rwts(const float* y, size_t n, const float* fit, float* rw) {
|
inline void rwts(const float* y, size_t n, const float* fit, float* rw) {
|
||||||
for (size_t i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
rw[i] = fabs(y[i] - fit[i]);
|
rw[i] = fabs(y[i] - fit[i]);
|
||||||
}
|
}
|
||||||
@ -222,7 +222,7 @@ void rwts(const float* y, size_t n, const float* fit, float* rw) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ss(const float* y, size_t n, size_t np, size_t ns, int isdeg, size_t nsjump, bool userw, float* rw, float* season, float* work1, float* work2, float* work3, float* work4) {
|
inline void ss(const float* y, size_t n, size_t np, size_t ns, int isdeg, size_t nsjump, bool userw, float* rw, float* season, float* work1, float* work2, float* work3, float* work4) { /// NOLINT(readability-non-const-parameter)
|
||||||
for (size_t j = 1; j <= np; j++) {
|
for (size_t j = 1; j <= np; j++) {
|
||||||
size_t k = (n - j) / np + 1;
|
size_t k = (n - j) / np + 1;
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ void ss(const float* y, size_t n, size_t np, size_t ns, int isdeg, size_t nsjump
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void onestp(const float* y, size_t n, size_t np, size_t ns, size_t nt, size_t nl, int isdeg, int itdeg, int ildeg, size_t nsjump, size_t ntjump, size_t nljump, size_t ni, bool userw, float* rw, float* season, float* trend, float* work1, float* work2, float* work3, float* work4, float* work5) {
|
inline void onestp(const float* y, size_t n, size_t np, size_t ns, size_t nt, size_t nl, int isdeg, int itdeg, int ildeg, size_t nsjump, size_t ntjump, size_t nljump, size_t ni, bool userw, float* rw, float* season, float* trend, float* work1, float* work2, float* work3, float* work4, float* work5) {
|
||||||
for (size_t j = 0; j < ni; j++) {
|
for (size_t j = 0; j < ni; j++) {
|
||||||
for (size_t i = 0; i < n; i++) {
|
for (size_t i = 0; i < n; i++) {
|
||||||
work1[i] = y[i] - trend[i];
|
work1[i] = y[i] - trend[i];
|
||||||
@ -272,7 +272,7 @@ void onestp(const float* y, size_t n, size_t np, size_t ns, size_t nt, size_t nl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void stl(const float* y, size_t n, size_t np, size_t ns, size_t nt, size_t nl, int isdeg, int itdeg, int ildeg, size_t nsjump, size_t ntjump, size_t nljump, size_t ni, size_t no, float* rw, float* season, float* trend) {
|
inline void stl(const float* y, size_t n, size_t np, size_t ns, size_t nt, size_t nl, int isdeg, int itdeg, int ildeg, size_t nsjump, size_t ntjump, size_t nljump, size_t ni, size_t no, float* rw, float* season, float* trend) {
|
||||||
if (ns < 3) {
|
if (ns < 3) {
|
||||||
throw std::invalid_argument("seasonal_length must be at least 3");
|
throw std::invalid_argument("seasonal_length must be at least 3");
|
||||||
}
|
}
|
||||||
@ -335,7 +335,7 @@ void stl(const float* y, size_t n, size_t np, size_t ns, size_t nt, size_t nl, i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float var(const std::vector<float>& series) {
|
inline float var(const std::vector<float>& series) {
|
||||||
auto mean = std::accumulate(series.begin(), series.end(), 0.0) / series.size();
|
auto mean = std::accumulate(series.begin(), series.end(), 0.0) / series.size();
|
||||||
std::vector<float> tmp;
|
std::vector<float> tmp;
|
||||||
tmp.reserve(series.size());
|
tmp.reserve(series.size());
|
||||||
@ -345,7 +345,7 @@ float var(const std::vector<float>& series) {
|
|||||||
return std::accumulate(tmp.begin(), tmp.end(), 0.0) / (series.size() - 1);
|
return std::accumulate(tmp.begin(), tmp.end(), 0.0) / (series.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float strength(const std::vector<float>& component, const std::vector<float>& remainder) {
|
inline float strength(const std::vector<float>& component, const std::vector<float>& remainder) {
|
||||||
std::vector<float> sr;
|
std::vector<float> sr;
|
||||||
sr.reserve(remainder.size());
|
sr.reserve(remainder.size());
|
||||||
for (size_t i = 0; i < remainder.size(); i++) {
|
for (size_t i = 0; i < remainder.size(); i++) {
|
||||||
@ -361,11 +361,11 @@ public:
|
|||||||
std::vector<float> remainder;
|
std::vector<float> remainder;
|
||||||
std::vector<float> weights;
|
std::vector<float> weights;
|
||||||
|
|
||||||
inline float seasonal_strength() {
|
float seasonal_strength() const {
|
||||||
return strength(seasonal, remainder);
|
return strength(seasonal, remainder);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline float trend_strength() {
|
float trend_strength() const {
|
||||||
return strength(trend, remainder);
|
return strength(trend, remainder);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -385,62 +385,62 @@ class StlParams {
|
|||||||
bool robust_ = false;
|
bool robust_ = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline StlParams seasonal_length(size_t ns) {
|
StlParams seasonal_length(size_t ns) {
|
||||||
this->ns_ = ns;
|
this->ns_ = ns;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams trend_length(size_t nt) {
|
StlParams trend_length(size_t nt) {
|
||||||
this->nt_ = nt;
|
this->nt_ = nt;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams low_pass_length(size_t nl) {
|
StlParams low_pass_length(size_t nl) {
|
||||||
this->nl_ = nl;
|
this->nl_ = nl;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams seasonal_degree(int isdeg) {
|
StlParams seasonal_degree(int isdeg) {
|
||||||
this->isdeg_ = isdeg;
|
this->isdeg_ = isdeg;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams trend_degree(int itdeg) {
|
StlParams trend_degree(int itdeg) {
|
||||||
this->itdeg_ = itdeg;
|
this->itdeg_ = itdeg;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams low_pass_degree(int ildeg) {
|
StlParams low_pass_degree(int ildeg) {
|
||||||
this->ildeg_ = ildeg;
|
this->ildeg_ = ildeg;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams seasonal_jump(size_t nsjump) {
|
StlParams seasonal_jump(size_t nsjump) {
|
||||||
this->nsjump_ = nsjump;
|
this->nsjump_ = nsjump;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams trend_jump(size_t ntjump) {
|
StlParams trend_jump(size_t ntjump) {
|
||||||
this->ntjump_ = ntjump;
|
this->ntjump_ = ntjump;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams low_pass_jump(size_t nljump) {
|
StlParams low_pass_jump(size_t nljump) {
|
||||||
this->nljump_ = nljump;
|
this->nljump_ = nljump;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams inner_loops(bool ni) {
|
StlParams inner_loops(bool ni) {
|
||||||
this->ni_ = ni;
|
this->ni_ = ni;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams outer_loops(bool no) {
|
StlParams outer_loops(bool no) {
|
||||||
this->no_ = no;
|
this->no_ = no;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline StlParams robust(bool robust) {
|
StlParams robust(bool robust) {
|
||||||
this->robust_ = robust;
|
this->robust_ = robust;
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -449,11 +449,11 @@ public:
|
|||||||
StlResult fit(const std::vector<float>& y, size_t np);
|
StlResult fit(const std::vector<float>& y, size_t np);
|
||||||
};
|
};
|
||||||
|
|
||||||
StlParams params() {
|
inline StlParams params() {
|
||||||
return StlParams();
|
return StlParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
StlResult StlParams::fit(const float* y, size_t n, size_t np) {
|
inline StlResult StlParams::fit(const float* y, size_t n, size_t np) {
|
||||||
if (n < 2 * np) {
|
if (n < 2 * np) {
|
||||||
throw std::invalid_argument("series has less than two periods");
|
throw std::invalid_argument("series has less than two periods");
|
||||||
}
|
}
|
||||||
@ -506,7 +506,7 @@ StlResult StlParams::fit(const float* y, size_t n, size_t np) {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
StlResult StlParams::fit(const std::vector<float>& y, size_t np) {
|
inline StlResult StlParams::fit(const std::vector<float>& y, size_t np) {
|
||||||
return StlParams::fit(y.data(), y.size(), np);
|
return StlParams::fit(y.data(), y.size(), np);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,10 +36,10 @@ public:
|
|||||||
|
|
||||||
/// Sets compression method and level.
|
/// Sets compression method and level.
|
||||||
/// Changing them will affect next file in the archive.
|
/// Changing them will affect next file in the archive.
|
||||||
virtual void setCompression(const String & /* compression_method */, int /* compression_level */ = kDefaultCompressionLevel) {}
|
virtual void setCompression(const String & /*compression_method*/, int /*compression_level*/) {}
|
||||||
|
|
||||||
/// Sets password. If the password is not empty it will enable encryption in the archive.
|
/// Sets password. If the password is not empty it will enable encryption in the archive.
|
||||||
virtual void setPassword(const String & /* password */) {}
|
virtual void setPassword(const String & /*password*/) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,10 +21,10 @@ public:
|
|||||||
WriteBufferT && out_,
|
WriteBufferT && out_,
|
||||||
int compression_level,
|
int compression_level,
|
||||||
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
||||||
char * existing_memory = nullptr,
|
char * existing_memory = nullptr, /// NOLINT(readability-non-const-parameter)
|
||||||
size_t alignment = 0,
|
size_t alignment = 0,
|
||||||
bool compress_empty_ = true)
|
bool compress_empty_ = true)
|
||||||
: WriteBufferWithOwnMemoryDecorator(std::move(out_), buf_size, existing_memory, alignment)
|
: WriteBufferWithOwnMemoryDecorator(std::move(out_), buf_size, existing_memory, alignment) /// NOLINT(bugprone-move-forwarding-reference)
|
||||||
, brotli(std::make_unique<BrotliStateWrapper>())
|
, brotli(std::make_unique<BrotliStateWrapper>())
|
||||||
, in_available(0)
|
, in_available(0)
|
||||||
, in_data(nullptr)
|
, in_data(nullptr)
|
||||||
|
@ -25,10 +25,10 @@ public:
|
|||||||
WriteBufferT && out_,
|
WriteBufferT && out_,
|
||||||
int compression_level,
|
int compression_level,
|
||||||
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
|
||||||
char * existing_memory = nullptr,
|
char * existing_memory = nullptr, /// NOLINT(readability-non-const-parameter)
|
||||||
size_t alignment = 0,
|
size_t alignment = 0,
|
||||||
bool compress_empty_ = true)
|
bool compress_empty_ = true)
|
||||||
: WriteBufferWithOwnMemoryDecorator(std::move(out_), buf_size, existing_memory, alignment)
|
: WriteBufferWithOwnMemoryDecorator(std::move(out_), buf_size, existing_memory, alignment) /// NOLINT(bugprone-move-forwarding-reference)
|
||||||
, compress_empty(compress_empty_)
|
, compress_empty(compress_empty_)
|
||||||
{
|
{
|
||||||
memset(&stream, 0, sizeof(stream));
|
memset(&stream, 0, sizeof(stream));
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user