mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 09:02:00 +00:00
Miscellaneous changes for PVS-Studio
This commit is contained in:
parent
17335ab1f1
commit
c7b95b5175
@ -25,12 +25,12 @@ namespace ErrorCodes
|
||||
struct ConnectionParameters
|
||||
{
|
||||
String host;
|
||||
UInt16 port;
|
||||
UInt16 port{};
|
||||
String default_database;
|
||||
String user;
|
||||
String password;
|
||||
Protocol::Secure security;
|
||||
Protocol::Compression compression;
|
||||
Protocol::Secure security = Protocol::Secure::Disable;
|
||||
Protocol::Compression compression = Protocol::Compression::Enable;
|
||||
ConnectionTimeouts timeouts;
|
||||
|
||||
ConnectionParameters() {}
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include <iostream>
|
||||
#include <Core/Types.h>
|
||||
#include <Common/Exception.h>
|
||||
#include <IO/ReadBufferFromString.h>
|
||||
#include <IO/Operators.h>
|
||||
#include <Parsers/Lexer.h>
|
||||
|
||||
|
||||
@ -91,14 +93,11 @@ private:
|
||||
|
||||
void parse(const String & hint)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << hint;
|
||||
ReadBufferFromString ss(hint);
|
||||
while (!ss.eof())
|
||||
{
|
||||
String item;
|
||||
ss >> item;
|
||||
if (item.empty())
|
||||
break;
|
||||
|
||||
if (item == "serverError")
|
||||
ss >> server_error;
|
||||
|
@ -86,7 +86,7 @@ public:
|
||||
ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT};
|
||||
}
|
||||
|
||||
events_size = arguments.size();
|
||||
events_size = static_cast<UInt8>(arguments.size());
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,11 +81,6 @@ CacheDictionary::CacheDictionary(
|
||||
createAttributes();
|
||||
}
|
||||
|
||||
CacheDictionary::CacheDictionary(const CacheDictionary & other)
|
||||
: CacheDictionary{other.name, other.dict_struct, other.source_ptr->clone(), other.dict_lifetime, other.size}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void CacheDictionary::toParent(const PaddedPODArray<Key> & ids, PaddedPODArray<Key> & out) const
|
||||
{
|
||||
|
@ -30,8 +30,6 @@ public:
|
||||
const DictionaryLifetime dict_lifetime,
|
||||
const size_t size);
|
||||
|
||||
CacheDictionary(const CacheDictionary & other);
|
||||
|
||||
std::exception_ptr getCreationException() const override { return {}; }
|
||||
|
||||
std::string getName() const override { return name; }
|
||||
@ -53,7 +51,10 @@ public:
|
||||
|
||||
bool isCached() const override { return true; }
|
||||
|
||||
std::unique_ptr<IExternalLoadable> clone() const override { return std::make_unique<CacheDictionary>(*this); }
|
||||
std::unique_ptr<IExternalLoadable> clone() const override
|
||||
{
|
||||
return std::make_unique<CacheDictionary>(name, dict_struct, source_ptr->clone(), dict_lifetime, size);
|
||||
}
|
||||
|
||||
const IDictionarySource * getSource() const override { return source_ptr.get(); }
|
||||
|
||||
|
@ -70,10 +70,6 @@ ComplexKeyCacheDictionary::ComplexKeyCacheDictionary(
|
||||
createAttributes();
|
||||
}
|
||||
|
||||
ComplexKeyCacheDictionary::ComplexKeyCacheDictionary(const ComplexKeyCacheDictionary & other)
|
||||
: ComplexKeyCacheDictionary{other.name, other.dict_struct, other.source_ptr->clone(), other.dict_lifetime, other.size}
|
||||
{
|
||||
}
|
||||
|
||||
void ComplexKeyCacheDictionary::getString(
|
||||
const std::string & attribute_name, const Columns & key_columns, const DataTypes & key_types, ColumnString * out) const
|
||||
|
@ -47,8 +47,6 @@ public:
|
||||
const DictionaryLifetime dict_lifetime,
|
||||
const size_t size);
|
||||
|
||||
ComplexKeyCacheDictionary(const ComplexKeyCacheDictionary & other);
|
||||
|
||||
std::string getKeyDescription() const { return key_description; }
|
||||
|
||||
std::exception_ptr getCreationException() const override { return {}; }
|
||||
@ -76,7 +74,10 @@ public:
|
||||
|
||||
bool isCached() const override { return true; }
|
||||
|
||||
std::unique_ptr<IExternalLoadable> clone() const override { return std::make_unique<ComplexKeyCacheDictionary>(*this); }
|
||||
std::unique_ptr<IExternalLoadable> clone() const override
|
||||
{
|
||||
return std::make_unique<ComplexKeyCacheDictionary>(name, dict_struct, source_ptr->clone(), dict_lifetime, size);
|
||||
}
|
||||
|
||||
const IDictionarySource * getSource() const override { return source_ptr.get(); }
|
||||
|
||||
|
@ -43,12 +43,6 @@ ComplexKeyHashedDictionary::ComplexKeyHashedDictionary(
|
||||
creation_time = std::chrono::system_clock::now();
|
||||
}
|
||||
|
||||
ComplexKeyHashedDictionary::ComplexKeyHashedDictionary(const ComplexKeyHashedDictionary & other)
|
||||
: ComplexKeyHashedDictionary{
|
||||
other.name, other.dict_struct, other.source_ptr->clone(), other.dict_lifetime, other.require_nonempty, other.saved_block}
|
||||
{
|
||||
}
|
||||
|
||||
#define DECLARE(TYPE) \
|
||||
void ComplexKeyHashedDictionary::get##TYPE( \
|
||||
const std::string & attribute_name, const Columns & key_columns, const DataTypes & key_types, ResultArrayType<TYPE> & out) const \
|
||||
|
@ -29,8 +29,6 @@ public:
|
||||
bool require_nonempty,
|
||||
BlockPtr saved_block = nullptr);
|
||||
|
||||
ComplexKeyHashedDictionary(const ComplexKeyHashedDictionary & other);
|
||||
|
||||
std::string getKeyDescription() const { return key_description; }
|
||||
|
||||
std::exception_ptr getCreationException() const override { return creation_exception; }
|
||||
@ -51,7 +49,10 @@ public:
|
||||
|
||||
bool isCached() const override { return false; }
|
||||
|
||||
std::unique_ptr<IExternalLoadable> clone() const override { return std::make_unique<ComplexKeyHashedDictionary>(*this); }
|
||||
std::unique_ptr<IExternalLoadable> clone() const override
|
||||
{
|
||||
return std::make_unique<ComplexKeyHashedDictionary>(name, dict_struct, source_ptr->clone(), dict_lifetime, require_nonempty, saved_block);
|
||||
}
|
||||
|
||||
const IDictionarySource * getSource() const override { return source_ptr.get(); }
|
||||
|
||||
|
@ -50,12 +50,6 @@ FlatDictionary::FlatDictionary(
|
||||
creation_time = std::chrono::system_clock::now();
|
||||
}
|
||||
|
||||
FlatDictionary::FlatDictionary(const FlatDictionary & other)
|
||||
: FlatDictionary{
|
||||
other.name, other.dict_struct, other.source_ptr->clone(), other.dict_lifetime, other.require_nonempty, other.saved_block}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void FlatDictionary::toParent(const PaddedPODArray<Key> & ids, PaddedPODArray<Key> & out) const
|
||||
{
|
||||
|
@ -28,8 +28,6 @@ public:
|
||||
bool require_nonempty,
|
||||
BlockPtr saved_block = nullptr);
|
||||
|
||||
FlatDictionary(const FlatDictionary & other);
|
||||
|
||||
std::exception_ptr getCreationException() const override { return creation_exception; }
|
||||
|
||||
std::string getName() const override { return name; }
|
||||
@ -48,7 +46,10 @@ public:
|
||||
|
||||
bool isCached() const override { return false; }
|
||||
|
||||
std::unique_ptr<IExternalLoadable> clone() const override { return std::make_unique<FlatDictionary>(*this); }
|
||||
std::unique_ptr<IExternalLoadable> clone() const override
|
||||
{
|
||||
return std::make_unique<FlatDictionary>(name, dict_struct, source_ptr->clone(), dict_lifetime, require_nonempty, saved_block);
|
||||
}
|
||||
|
||||
const IDictionarySource * getSource() const override { return source_ptr.get(); }
|
||||
|
||||
|
@ -44,12 +44,6 @@ HashedDictionary::HashedDictionary(
|
||||
creation_time = std::chrono::system_clock::now();
|
||||
}
|
||||
|
||||
HashedDictionary::HashedDictionary(const HashedDictionary & other)
|
||||
: HashedDictionary{
|
||||
other.name, other.dict_struct, other.source_ptr->clone(), other.dict_lifetime, other.require_nonempty, other.saved_block}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void HashedDictionary::toParent(const PaddedPODArray<Key> & ids, PaddedPODArray<Key> & out) const
|
||||
{
|
||||
|
@ -27,8 +27,6 @@ public:
|
||||
bool require_nonempty,
|
||||
BlockPtr saved_block = nullptr);
|
||||
|
||||
HashedDictionary(const HashedDictionary & other);
|
||||
|
||||
std::exception_ptr getCreationException() const override { return creation_exception; }
|
||||
|
||||
std::string getName() const override { return name; }
|
||||
@ -47,7 +45,10 @@ public:
|
||||
|
||||
bool isCached() const override { return false; }
|
||||
|
||||
std::unique_ptr<IExternalLoadable> clone() const override { return std::make_unique<HashedDictionary>(*this); }
|
||||
std::unique_ptr<IExternalLoadable> clone() const override
|
||||
{
|
||||
return std::make_unique<HashedDictionary>(name, dict_struct, source_ptr->clone(), dict_lifetime, require_nonempty, saved_block);
|
||||
}
|
||||
|
||||
const IDictionarySource * getSource() const override { return source_ptr.get(); }
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <vector>
|
||||
#include <DataStreams/IBlockInputStream.h>
|
||||
|
||||
|
||||
namespace DB
|
||||
{
|
||||
class IDictionarySource;
|
||||
|
@ -94,12 +94,6 @@ RangeHashedDictionary::RangeHashedDictionary(
|
||||
creation_time = std::chrono::system_clock::now();
|
||||
}
|
||||
|
||||
RangeHashedDictionary::RangeHashedDictionary(const RangeHashedDictionary & other)
|
||||
: RangeHashedDictionary{
|
||||
other.dictionary_name, other.dict_struct, other.source_ptr->clone(), other.dict_lifetime, other.require_nonempty}
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
#define DECLARE_MULTIPLE_GETTER(TYPE) \
|
||||
void RangeHashedDictionary::get##TYPE( \
|
||||
|
@ -24,8 +24,6 @@ public:
|
||||
const DictionaryLifetime dict_lifetime,
|
||||
bool require_nonempty);
|
||||
|
||||
RangeHashedDictionary(const RangeHashedDictionary & other);
|
||||
|
||||
std::exception_ptr getCreationException() const override { return creation_exception; }
|
||||
|
||||
std::string getName() const override { return dictionary_name; }
|
||||
@ -44,7 +42,10 @@ public:
|
||||
|
||||
bool isCached() const override { return false; }
|
||||
|
||||
std::unique_ptr<IExternalLoadable> clone() const override { return std::make_unique<RangeHashedDictionary>(*this); }
|
||||
std::unique_ptr<IExternalLoadable> clone() const override
|
||||
{
|
||||
return std::make_unique<RangeHashedDictionary>(dictionary_name, dict_struct, source_ptr->clone(), dict_lifetime, require_nonempty);
|
||||
}
|
||||
|
||||
const IDictionarySource * getSource() const override { return source_ptr.get(); }
|
||||
|
||||
|
@ -63,11 +63,6 @@ TrieDictionary::TrieDictionary(
|
||||
creation_time = std::chrono::system_clock::now();
|
||||
}
|
||||
|
||||
TrieDictionary::TrieDictionary(const TrieDictionary & other)
|
||||
: TrieDictionary{other.name, other.dict_struct, other.source_ptr->clone(), other.dict_lifetime, other.require_nonempty}
|
||||
{
|
||||
}
|
||||
|
||||
TrieDictionary::~TrieDictionary()
|
||||
{
|
||||
btrie_destroy(trie);
|
||||
|
@ -29,8 +29,6 @@ public:
|
||||
const DictionaryLifetime dict_lifetime,
|
||||
bool require_nonempty);
|
||||
|
||||
TrieDictionary(const TrieDictionary & other);
|
||||
|
||||
~TrieDictionary() override;
|
||||
|
||||
std::string getKeyDescription() const { return key_description; }
|
||||
@ -53,7 +51,10 @@ public:
|
||||
|
||||
bool isCached() const override { return false; }
|
||||
|
||||
std::unique_ptr<IExternalLoadable> clone() const override { return std::make_unique<TrieDictionary>(*this); }
|
||||
std::unique_ptr<IExternalLoadable> clone() const override
|
||||
{
|
||||
return std::make_unique<TrieDictionary>(name, dict_struct, source_ptr->clone(), dict_lifetime, require_nonempty);
|
||||
}
|
||||
|
||||
const IDictionarySource * getSource() const override { return source_ptr.get(); }
|
||||
|
||||
|
@ -904,7 +904,7 @@ public:
|
||||
using T0 = typename Types::LeftType;
|
||||
using T1 = typename Types::RightType;
|
||||
|
||||
if constexpr ((IsDecimalNumber<T0> && IsDecimalNumber<T1>) || (!IsDecimalNumber<T0> && !IsDecimalNumber<T1>))
|
||||
if constexpr (IsDecimalNumber<T0> == IsDecimalNumber<T1>)
|
||||
return executeTyped<T0, T1>(cond_col, block, arguments, result, input_rows_count);
|
||||
else
|
||||
throw Exception("Conditional function with Decimal and non Decimal", ErrorCodes::NOT_IMPLEMENTED);
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <Core/Types.h>
|
||||
|
||||
|
||||
@ -26,7 +27,7 @@ struct ExternalLoadableLifetime final
|
||||
|
||||
|
||||
/// Basic interface for external loadable objects. Is used in ExternalLoader.
|
||||
class IExternalLoadable : public std::enable_shared_from_this<IExternalLoadable>
|
||||
class IExternalLoadable : public std::enable_shared_from_this<IExternalLoadable>, private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
virtual ~IExternalLoadable() = default;
|
||||
|
@ -354,8 +354,6 @@ std::pair<const char *, bool> splitMultipartQuery(const std::string & queries, s
|
||||
begin = pos;
|
||||
|
||||
ast = parseQueryAndMovePosition(parser, pos, end, "", true, 0);
|
||||
if (!ast)
|
||||
break;
|
||||
|
||||
ASTInsertQuery * insert = typeid_cast<ASTInsertQuery *>(ast.get());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user