Fix clang-tidy warnings in Disks, Formats, Functions folders

This commit is contained in:
Maksim Kita 2022-03-12 18:05:50 +00:00
parent 1d674123a9
commit 538f8cbaad
65 changed files with 294 additions and 286 deletions

View File

@ -22,7 +22,7 @@ class WriteBufferFromFileBase;
class DiskMemory : public IDisk
{
public:
DiskMemory(const String & name_) : name(name_), disk_path("memory://" + name_ + '/') {}
explicit DiskMemory(const String & name_) : name(name_), disk_path("memory://" + name_ + '/') {}
const String & getName() const override { return name; }
@ -97,7 +97,6 @@ private:
void createDirectoriesImpl(const String & path);
void replaceFileImpl(const String & from_path, const String & to_path);
private:
friend class WriteIndirectBuffer;
enum class FileType
@ -112,7 +111,7 @@ private:
String data;
FileData(FileType type_, String data_) : type(type_), data(std::move(data_)) {}
explicit FileData(FileType type_) : type(type_), data("") {}
explicit FileData(FileType type_) : type(type_) {}
};
using Files = std::unordered_map<String, FileData>; /// file path -> file data

View File

@ -19,7 +19,7 @@ class DiskSelector
{
public:
DiskSelector(const Poco::Util::AbstractConfiguration & config, const String & config_prefix, ContextPtr context);
DiskSelector(const DiskSelector & from) : disks(from.disks) { }
DiskSelector(const DiskSelector & from) = default;
DiskSelectorPtr updateFromConfig(
const Poco::Util::AbstractConfiguration & config,

View File

@ -38,7 +38,7 @@ namespace ErrorCodes
*
* To get files for upload run:
* clickhouse static-files-disk-uploader --metadata-path <path> --output-dir <dir>
* (--metadata-path can be found in query: `select data_paths from system.tables where name='<table_name>';`)
* (--metadata-path can be found in query: `select data_paths from system.tables where name='<table_name>';`) /// NOLINT
*
* When loading files by <endpoint> they must be loaded into <endpoint>/store/ path, but config must conrain only <endpoint>.
*

View File

@ -158,14 +158,14 @@ public:
virtual void listFiles(const String & path, std::vector<String> & file_names) = 0;
/// Open the file for read and return ReadBufferFromFileBase object.
virtual std::unique_ptr<ReadBufferFromFileBase> readFile(
virtual std::unique_ptr<ReadBufferFromFileBase> readFile( /// NOLINT
const String & path,
const ReadSettings & settings = ReadSettings{},
std::optional<size_t> read_hint = {},
std::optional<size_t> file_size = {}) const = 0;
/// Open the file for write and return WriteBufferFromFileBase object.
virtual std::unique_ptr<WriteBufferFromFileBase> writeFile(
virtual std::unique_ptr<WriteBufferFromFileBase> writeFile( /// NOLINT
const String & path,
size_t buf_size = DBMS_DEFAULT_BUFFER_SIZE,
WriteMode mode = WriteMode::Rewrite) = 0;
@ -354,7 +354,7 @@ public:
virtual UInt64 getSize() const = 0;
/// Get i-th disk where reservation take place.
virtual DiskPtr getDisk(size_t i = 0) const = 0;
virtual DiskPtr getDisk(size_t i = 0) const = 0; /// NOLINT
/// Get all disks, used in reservation
virtual Disks getDisks() const = 0;

View File

@ -13,7 +13,6 @@
#include <Common/ThreadPool.h>
#include <filesystem>
namespace fs = std::filesystem;
namespace CurrentMetrics
{
@ -28,7 +27,7 @@ namespace DB
class RemoteFSPathKeeper
{
public:
RemoteFSPathKeeper(size_t chunk_limit_) : chunk_limit(chunk_limit_) {}
explicit RemoteFSPathKeeper(size_t chunk_limit_) : chunk_limit(chunk_limit_) {}
virtual ~RemoteFSPathKeeper() = default;

View File

@ -17,8 +17,8 @@ class LocalDirectorySyncGuard final : public ISyncGuard
public:
/// NOTE: If you have already opened descriptor, it's preferred to use
/// this constructor instead of constructor with path.
LocalDirectorySyncGuard(int fd_) : fd(fd_) {}
LocalDirectorySyncGuard(const String & full_path);
explicit LocalDirectorySyncGuard(int fd_) : fd(fd_) {}
explicit LocalDirectorySyncGuard(const String & full_path);
~LocalDirectorySyncGuard() override;
private:

View File

@ -15,7 +15,7 @@ using DiskPtr = std::shared_ptr<IDisk>;
class TemporaryFileOnDisk
{
public:
TemporaryFileOnDisk(const DiskPtr & disk_, const String & prefix_ = "tmp");
explicit TemporaryFileOnDisk(const DiskPtr & disk_, const String & prefix_ = "tmp");
~TemporaryFileOnDisk();
DiskPtr getDisk() const { return disk; }

View File

@ -18,14 +18,14 @@ struct DestructorCatcher
{
T impl;
template <typename ... Arg>
DestructorCatcher(Arg && ... args) : impl(kj::fwd<Arg>(args)...) {}
explicit DestructorCatcher(Arg && ... args) : impl(kj::fwd<Arg>(args)...) {}
~DestructorCatcher() noexcept try { } catch (...) { return; }
};
class CapnProtoSchemaParser : public DestructorCatcher<capnp::SchemaParser>
{
public:
CapnProtoSchemaParser() {}
CapnProtoSchemaParser() = default;
capnp::StructSchema getMessageSchema(const FormatSchemaInfo & schema_info);
};

View File

@ -1,5 +1,7 @@
#pragma once
#include <DataTypes/IDataType.h>
#include <DataTypes/Serializations/ISerialization.h>
#include <Formats/FormatSettings.h>
#include <IO/BufferWithOwnMemory.h>
#include <IO/ReadBuffer.h>

View File

@ -33,7 +33,7 @@ struct MarkInCompressedFile
return "(" + DB::toString(offset_in_compressed_file) + "," + DB::toString(offset_in_decompressed_block) + ")";
}
String toStringWithRows(size_t rows_num)
String toStringWithRows(size_t rows_num) const
{
return "(" + DB::toString(offset_in_compressed_file) + "," + DB::toString(offset_in_decompressed_block) + "," + DB::toString(rows_num) + ")";
}
@ -43,7 +43,7 @@ struct MarkInCompressedFile
class MarksInCompressedFile : public PODArray<MarkInCompressedFile>
{
public:
MarksInCompressedFile(size_t n) : PODArray(n) {}
explicit MarksInCompressedFile(size_t n) : PODArray(n) {}
void read(ReadBuffer & buffer, size_t from, size_t count)
{

View File

@ -28,7 +28,7 @@ struct ParsedTemplateFormatString
/// For diagnostic info
Strings column_names;
typedef std::function<std::optional<size_t>(const String &)> ColumnIdxGetter;
using ColumnIdxGetter = std::function<std::optional<size_t>(const String &)>;
ParsedTemplateFormatString() = default;
ParsedTemplateFormatString(const FormatSchemaInfo & schema, const ColumnIdxGetter & idx_by_name, bool allow_indexes = true);

View File

@ -16,7 +16,7 @@ class ReadBuffer;
class ProtobufReader
{
public:
ProtobufReader(ReadBuffer & in_);
explicit ProtobufReader(ReadBuffer & in_);
void startMessage(bool with_length_delimiter_);
void endMessage(bool ignore_errors);

View File

@ -16,7 +16,7 @@ class WriteBuffer;
class ProtobufWriter
{
public:
ProtobufWriter(WriteBuffer & out_);
explicit ProtobufWriter(WriteBuffer & out_);
~ProtobufWriter();
void startMessage();

View File

@ -14,7 +14,7 @@ class RowInputMissingColumnsFiller
{
public:
/// Makes a column filler which checks nested structures while adding default values to columns.
RowInputMissingColumnsFiller(const NamesAndTypesList & names_and_types);
explicit RowInputMissingColumnsFiller(const NamesAndTypesList & names_and_types);
RowInputMissingColumnsFiller(const Names & names, const DataTypes & types);
RowInputMissingColumnsFiller(size_t count, const std::string_view * names, const DataTypePtr * types);

View File

@ -83,7 +83,7 @@ struct CountSubstringsImpl
{
res = 0;
if (needle.size() == 0)
if (needle.empty())
return;
auto start = std::max(start_pos, UInt64(1));

View File

@ -6,6 +6,7 @@
#include <Common/NaNUtils.h>
#include <DataTypes/NumberTraits.h>
#include "config_core.h"
#include <Common/config.h>

View File

@ -2,6 +2,8 @@
#include <Common/Exception.h>
#include <base/types.h>
#include <base/defines.h>
namespace DB
{
@ -22,25 +24,25 @@ struct DummyJSONParser
class Element
{
public:
Element() {}
bool isInt64() const { return false; }
bool isUInt64() const { return false; }
bool isDouble() const { return false; }
bool isString() const { return false; }
bool isArray() const { return false; }
bool isObject() const { return false; }
bool isBool() const { return false; }
bool isNull() const { return false; }
Element() = default;
static bool isInt64() { return false; }
static bool isUInt64() { return false; }
static bool isDouble() { return false; }
static bool isString() { return false; }
static bool isArray() { return false; }
static bool isObject() { return false; }
static bool isBool() { return false; }
static bool isNull() { return false; }
Int64 getInt64() const { return 0; }
UInt64 getUInt64() const { return 0; }
double getDouble() const { return 0; }
bool getBool() const { return false; }
std::string_view getString() const { return {}; }
Array getArray() const { return {}; }
Object getObject() const { return {}; }
static Int64 getInt64() { return 0; }
static UInt64 getUInt64() { return 0; }
static double getDouble() { return 0; }
static bool getBool() { return false; }
static std::string_view getString() { return {}; }
static Array getArray() { return {}; }
static Object getObject() { return {}; }
Element getElement() { return {}; }
static Element getElement() { return {}; }
};
/// References an array in a JSON document.
@ -52,14 +54,14 @@ struct DummyJSONParser
public:
Element operator*() const { return {}; }
Iterator & operator++() { return *this; }
Iterator operator++(int) { return *this; }
Iterator operator++(int) { return *this; } /// NOLINT
friend bool operator==(const Iterator &, const Iterator &) { return true; }
friend bool operator!=(const Iterator &, const Iterator &) { return false; }
};
Iterator begin() const { return {}; }
Iterator end() const { return {}; }
size_t size() const { return 0; }
static Iterator begin() { return {}; }
static Iterator end() { return {}; }
static size_t size() { return 0; }
Element operator[](size_t) const { return {}; }
};
@ -74,15 +76,15 @@ struct DummyJSONParser
public:
KeyValuePair operator*() const { return {}; }
Iterator & operator++() { return *this; }
Iterator operator++(int) { return *this; }
Iterator operator++(int) { return *this; } /// NOLINT
friend bool operator==(const Iterator &, const Iterator &) { return true; }
friend bool operator!=(const Iterator &, const Iterator &) { return false; }
};
Iterator begin() const { return {}; }
Iterator end() const { return {}; }
size_t size() const { return 0; }
bool find(const std::string_view &, Element &) const { return false; }
static Iterator begin() { return {}; }
static Iterator end() { return {}; }
static size_t size() { return 0; }
bool find(const std::string_view &, Element &) const { return false; } /// NOLINT
#if 0
/// Optional: Provides access to an object's element by index.
@ -91,7 +93,7 @@ struct DummyJSONParser
};
/// Parses a JSON document, returns the reference to its root element if succeeded.
bool parse(const std::string_view &, Element &) { throw Exception{"Functions JSON* are not supported", ErrorCodes::NOT_IMPLEMENTED}; }
bool parse(const std::string_view &, Element &) { throw Exception{"Functions JSON* are not supported", ErrorCodes::NOT_IMPLEMENTED}; } /// NOLINT
#if 0
/// Optional: Allocates memory to parse JSON documents faster.

View File

@ -2,6 +2,7 @@
#include <Common/memcmpSmall.h>
#include <Columns/ColumnString.h>
#include <Columns/ColumnsNumber.h>
#include <Functions/FunctionFactory.h>

View File

@ -5,6 +5,7 @@
#include <Functions/IFunction.h>
#include <Functions/FunctionHelpers.h>
#include <IO/WriteHelpers.h>
#include <Interpreters/Context_fwd.h>
#include <base/range.h>

View File

@ -7,6 +7,7 @@
#include <Functions/IFunction.h>
#include <Functions/TransformDateTime64.h>
#include <IO/WriteHelpers.h>
#include <Interpreters/Context_fwd.h>
namespace DB

View File

@ -242,7 +242,7 @@ public:
GeneratorJSONPath<JSONParser> generator_json_path(query_ptr);
Element current_element = root;
VisitorStatus status;
Element res;
while ((status = generator_json_path.getNextItem(current_element)) != VisitorStatus::Exhausted)
{
if (status == VisitorStatus::Ok)

View File

@ -24,7 +24,7 @@ namespace ErrorCodes
* https://blog.twitter.com/engineering/en_us/a/2010/announcing-snowflake
* https://ws-dl.blogspot.com/2019/08/2019-08-03-tweetedat-finding-tweet.html
*/
static constexpr long snowflake_epoch = 1288834974657L;
static constexpr size_t snowflake_epoch = 1288834974657L;
static constexpr int time_shift = 22;
class FunctionDateTimeToSnowflake : public IFunction
@ -33,7 +33,7 @@ private:
const char * name;
public:
FunctionDateTimeToSnowflake(const char * name_) : name(name_) { }
explicit FunctionDateTimeToSnowflake(const char * name_) : name(name_) { }
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 1; }
@ -74,7 +74,7 @@ private:
const char * name;
public:
FunctionSnowflakeToDateTime(const char * name_) : name(name_) { }
explicit FunctionSnowflakeToDateTime(const char * name_) : name(name_) { }
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 0; }
@ -84,7 +84,7 @@ public:
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
{
if (arguments.size() < 1 || arguments.size() > 2)
if (arguments.empty() || arguments.size() > 2)
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Function {} takes one or two arguments", name);
if (!typeid_cast<const DataTypeInt64 *>(arguments[0].type.get()))
@ -122,7 +122,7 @@ private:
const char * name;
public:
FunctionDateTime64ToSnowflake(const char * name_) : name(name_) { }
explicit FunctionDateTime64ToSnowflake(const char * name_) : name(name_) { }
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 1; }
@ -163,7 +163,7 @@ private:
const char * name;
public:
FunctionSnowflakeToDateTime64(const char * name_) : name(name_) { }
explicit FunctionSnowflakeToDateTime64(const char * name_) : name(name_) { }
String getName() const override { return name; }
size_t getNumberOfArguments() const override { return 0; }
@ -173,7 +173,7 @@ public:
DataTypePtr getReturnTypeImpl(const ColumnsWithTypeAndName & arguments) const override
{
if (arguments.size() < 1 || arguments.size() > 2)
if (arguments.empty() || arguments.size() > 2)
throw Exception(ErrorCodes::NUMBER_OF_ARGUMENTS_DOESNT_MATCH, "Function {} takes one or two arguments", name);
if (!typeid_cast<const DataTypeInt64 *>(arguments[0].type.get()))

View File

@ -9,6 +9,7 @@
#include <Columns/ColumnArray.h>
#include <Columns/ColumnMap.h>
#include <Columns/ColumnsNumber.h>
#include <Interpreters/Context_fwd.h>
namespace DB

View File

@ -421,7 +421,7 @@ private:
for (size_t i = 0; i < input_rows_count; ++i)
{
const AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
const AggregateFunctionGroupBitmapData<T> & bitmap_data_0
= *reinterpret_cast<const AggregateFunctionGroupBitmapData<T>*>(data_ptr_0);
const UInt64 range_start = is_column_const[1] ? (*container1)[0] : (*container1)[i];
@ -615,7 +615,7 @@ private:
size_t to_end;
for (size_t i = 0; i < input_rows_count; ++i)
{
const AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
const AggregateFunctionGroupBitmapData<T> & bitmap_data_0
= *reinterpret_cast<const AggregateFunctionGroupBitmapData<T> *>(data_ptr_0);
if (is_column_const[1])
@ -923,7 +923,7 @@ private:
for (size_t i = 0; i < input_rows_count; ++i)
{
const AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
AggregateDataPtr data_ptr_0 = is_column_const[0] ? (*container0)[0] : (*container0)[i];
const UInt64 data1 = is_column_const[1] ? (*container1)[0] : (*container1)[i];
const AggregateFunctionGroupBitmapData<T> & bitmap_data_0
= *reinterpret_cast<const AggregateFunctionGroupBitmapData<T> *>(data_ptr_0);
@ -1030,8 +1030,8 @@ private:
for (size_t i = 0; i < input_rows_count; ++i)
{
const AggregateDataPtr data_ptr_0 = is_column_const[0] ? container0[0] : container0[i];
const AggregateDataPtr data_ptr_1 = is_column_const[1] ? container1[0] : container1[i];
AggregateDataPtr data_ptr_0 = is_column_const[0] ? container0[0] : container0[i];
AggregateDataPtr data_ptr_1 = is_column_const[1] ? container1[0] : container1[i];
const AggregateFunctionGroupBitmapData<T> & bitmap_data_1
= *reinterpret_cast<const AggregateFunctionGroupBitmapData<T> *>(data_ptr_0);
const AggregateFunctionGroupBitmapData<T> & bitmap_data_2
@ -1178,8 +1178,8 @@ private:
for (size_t i = 0; i < input_rows_count; ++i)
{
const AggregateDataPtr data_ptr_0 = is_column_const[0] ? container0[0] : container0[i];
const AggregateDataPtr data_ptr_1 = is_column_const[1] ? container1[0] : container1[i];
AggregateDataPtr data_ptr_0 = is_column_const[0] ? container0[0] : container0[i];
AggregateDataPtr data_ptr_1 = is_column_const[1] ? container1[0] : container1[i];
// bitmapAnd(RoaringBitMap, SmallSet) is slower than bitmapAnd(SmallSet, RoaringBitMap), so we can exchange the position of two arguments for the speed
auto * bm_1 = reinterpret_cast<AggregateFunctionGroupBitmapData<T> *>(data_ptr_0);

View File

@ -137,7 +137,7 @@ struct NumComparisonImpl
template <typename Op>
struct StringComparisonImpl
{
static void NO_INLINE string_vector_string_vector(
static void NO_INLINE string_vector_string_vector( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray<UInt8> & c)
@ -157,7 +157,7 @@ struct StringComparisonImpl
}
}
static void NO_INLINE string_vector_fixed_string_vector(
static void NO_INLINE string_vector_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray<UInt8> & c)
@ -175,7 +175,7 @@ struct StringComparisonImpl
}
}
static void NO_INLINE string_vector_constant(
static void NO_INLINE string_vector_constant( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, ColumnString::Offset b_size,
PaddedPODArray<UInt8> & c)
@ -193,7 +193,7 @@ struct StringComparisonImpl
}
}
static void fixed_string_vector_string_vector(
static void fixed_string_vector_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray<UInt8> & c)
@ -201,7 +201,7 @@ struct StringComparisonImpl
StringComparisonImpl<typename Op::SymmetricOp>::string_vector_fixed_string_vector(b_data, b_offsets, a_data, a_n, c);
}
static void NO_INLINE fixed_string_vector_fixed_string_vector_16(
static void NO_INLINE fixed_string_vector_fixed_string_vector_16( /// NOLINT
const ColumnString::Chars & a_data,
const ColumnString::Chars & b_data,
PaddedPODArray<UInt8> & c)
@ -212,7 +212,7 @@ struct StringComparisonImpl
c[j] = Op::apply(memcmp16(&a_data[i], &b_data[i]), 0);
}
static void NO_INLINE fixed_string_vector_constant_16(
static void NO_INLINE fixed_string_vector_constant_16( /// NOLINT
const ColumnString::Chars & a_data,
const ColumnString::Chars & b_data,
PaddedPODArray<UInt8> & c)
@ -223,7 +223,7 @@ struct StringComparisonImpl
c[j] = Op::apply(memcmp16(&a_data[i], &b_data[0]), 0);
}
static void NO_INLINE fixed_string_vector_fixed_string_vector(
static void NO_INLINE fixed_string_vector_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray<UInt8> & c)
@ -250,7 +250,7 @@ struct StringComparisonImpl
}
}
static void NO_INLINE fixed_string_vector_constant(
static void NO_INLINE fixed_string_vector_constant( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, ColumnString::Offset b_size,
PaddedPODArray<UInt8> & c)
@ -273,7 +273,7 @@ struct StringComparisonImpl
}
}
static void constant_string_vector(
static void constant_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_size,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray<UInt8> & c)
@ -281,7 +281,7 @@ struct StringComparisonImpl
StringComparisonImpl<typename Op::SymmetricOp>::string_vector_constant(b_data, b_offsets, a_data, a_size, c);
}
static void constant_fixed_string_vector(
static void constant_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_size,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray<UInt8> & c)
@ -295,7 +295,7 @@ struct StringComparisonImpl
template <bool positive>
struct StringEqualsImpl
{
static void NO_INLINE string_vector_string_vector(
static void NO_INLINE string_vector_string_vector( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray<UInt8> & c)
@ -318,7 +318,7 @@ struct StringEqualsImpl
}
}
static void NO_INLINE string_vector_fixed_string_vector(
static void NO_INLINE string_vector_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray<UInt8> & c)
@ -338,7 +338,7 @@ struct StringEqualsImpl
}
}
static void NO_INLINE string_vector_constant(
static void NO_INLINE string_vector_constant( /// NOLINT
const ColumnString::Chars & a_data, const ColumnString::Offsets & a_offsets,
const ColumnString::Chars & b_data, ColumnString::Offset b_size,
PaddedPODArray<UInt8> & c)
@ -358,7 +358,7 @@ struct StringEqualsImpl
}
}
static void NO_INLINE fixed_string_vector_fixed_string_vector_16(
static void NO_INLINE fixed_string_vector_fixed_string_vector_16( /// NOLINT
const ColumnString::Chars & a_data,
const ColumnString::Chars & b_data,
PaddedPODArray<UInt8> & c)
@ -371,7 +371,7 @@ struct StringEqualsImpl
b_data.data() + i * 16);
}
static void NO_INLINE fixed_string_vector_constant_16(
static void NO_INLINE fixed_string_vector_constant_16( /// NOLINT
const ColumnString::Chars & a_data,
const ColumnString::Chars & b_data,
PaddedPODArray<UInt8> & c)
@ -384,7 +384,7 @@ struct StringEqualsImpl
b_data.data());
}
static void NO_INLINE fixed_string_vector_fixed_string_vector(
static void NO_INLINE fixed_string_vector_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray<UInt8> & c)
@ -410,7 +410,7 @@ struct StringEqualsImpl
}
}
static void NO_INLINE fixed_string_vector_constant(
static void NO_INLINE fixed_string_vector_constant( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, ColumnString::Offset b_size,
PaddedPODArray<UInt8> & c)
@ -427,7 +427,7 @@ struct StringEqualsImpl
}
}
static void fixed_string_vector_string_vector(
static void fixed_string_vector_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_n,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray<UInt8> & c)
@ -435,7 +435,7 @@ struct StringEqualsImpl
string_vector_fixed_string_vector(b_data, b_offsets, a_data, a_n, c);
}
static void constant_string_vector(
static void constant_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_size,
const ColumnString::Chars & b_data, const ColumnString::Offsets & b_offsets,
PaddedPODArray<UInt8> & c)
@ -443,7 +443,7 @@ struct StringEqualsImpl
string_vector_constant(b_data, b_offsets, a_data, a_size, c);
}
static void constant_fixed_string_vector(
static void constant_fixed_string_vector( /// NOLINT
const ColumnString::Chars & a_data, ColumnString::Offset a_size,
const ColumnString::Chars & b_data, ColumnString::Offset b_n,
PaddedPODArray<UInt8> & c)

View File

@ -542,7 +542,7 @@ struct ToDateTime64TransformUnsigned
const DateTime64::NativeType scale_multiplier = 1;
ToDateTime64TransformUnsigned(UInt32 scale = 0)
ToDateTime64TransformUnsigned(UInt32 scale = 0) /// NOLINT
: scale_multiplier(DecimalUtils::scaleMultiplier<DateTime64::NativeType>(scale))
{}
@ -559,7 +559,7 @@ struct ToDateTime64TransformSigned
const DateTime64::NativeType scale_multiplier = 1;
ToDateTime64TransformSigned(UInt32 scale = 0)
ToDateTime64TransformSigned(UInt32 scale = 0) /// NOLINT
: scale_multiplier(DecimalUtils::scaleMultiplier<DateTime64::NativeType>(scale))
{}
@ -577,7 +577,7 @@ struct ToDateTime64TransformFloat
const UInt32 scale = 1;
ToDateTime64TransformFloat(UInt32 scale_ = 0)
ToDateTime64TransformFloat(UInt32 scale_ = 0) /// NOLINT
: scale(scale_)
{}
@ -615,7 +615,7 @@ struct FromDateTime64Transform
const DateTime64::NativeType scale_multiplier = 1;
FromDateTime64Transform(UInt32 scale)
FromDateTime64Transform(UInt32 scale) /// NOLINT
: scale_multiplier(DecimalUtils::scaleMultiplier<DateTime64::NativeType>(scale))
{}
@ -639,7 +639,7 @@ struct ToDateTime64Transform
const DateTime64::NativeType scale_multiplier = 1;
ToDateTime64Transform(UInt32 scale = 0)
ToDateTime64Transform(UInt32 scale = 0) /// NOLINT
: scale_multiplier(DecimalUtils::scaleMultiplier<DateTime64::NativeType>(scale))
{}

View File

@ -897,7 +897,9 @@ private:
result = std::move(dictionary_get_result_column);
}
else
result = ColumnNullable::create(std::move(dictionary_get_result_column), std::move(is_key_in_dictionary_column_mutable));
{
result = ColumnNullable::create(dictionary_get_result_column, std::move(is_key_in_dictionary_column_mutable));
}
}
return result;

View File

@ -7,6 +7,7 @@
#include <Functions/IFunction.h>
#include <IO/WriteHelpers.h>
#include <type_traits>
#include <Interpreters/Context_fwd.h>
#if USE_EMBEDDED_COMPILER
@ -147,7 +148,6 @@ public:
static constexpr auto name = Name::name;
static FunctionPtr create(ContextPtr) { return std::make_shared<FunctionAnyArityLogical>(); }
public:
String getName() const override
{
return name;
@ -189,7 +189,7 @@ public:
result = Impl::apply(b, result, nativeBoolCast(b, types[i], values[i]));
return b.CreateSelect(result, b.getInt8(1), b.getInt8(0));
}
constexpr bool breakOnTrue = Impl::isSaturatedValue(true);
constexpr bool break_on_true = Impl::isSaturatedValue(true);
auto * next = b.GetInsertBlock();
auto * stop = llvm::BasicBlock::Create(next->getContext(), "", next->getParent());
b.SetInsertPoint(stop);
@ -205,7 +205,7 @@ public:
if (i + 1 < types.size())
{
next = llvm::BasicBlock::Create(next->getContext(), "", next->getParent());
b.CreateCondBr(truth, breakOnTrue ? stop : next, breakOnTrue ? next : stop);
b.CreateCondBr(truth, break_on_true ? stop : next, break_on_true ? next : stop);
}
}
b.CreateBr(stop);
@ -223,7 +223,6 @@ public:
static constexpr auto name = Name::name;
static FunctionPtr create(ContextPtr) { return std::make_shared<FunctionUnaryLogical>(); }
public:
String getName() const override
{
return name;

View File

@ -93,7 +93,7 @@ public:
}
/// Returns the position of the argument, that is the column of strings
size_t getStringsArgumentPosition()
static size_t getStringsArgumentPosition()
{
return 0;
}
@ -152,7 +152,7 @@ public:
}
/// Returns the position of the argument, that is the column of strings
size_t getStringsArgumentPosition()
static size_t getStringsArgumentPosition()
{
return 0;
}
@ -211,7 +211,7 @@ public:
}
/// Returns the position of the argument, that is the column of strings
size_t getStringsArgumentPosition()
static size_t getStringsArgumentPosition()
{
return 0;
}
@ -328,7 +328,7 @@ public:
}
/// Returns the position of the argument, that is the column of strings
size_t getStringsArgumentPosition()
static size_t getStringsArgumentPosition()
{
return 1;
}
@ -399,7 +399,7 @@ public:
}
/// Returns the position of the argument that is the column of strings
size_t getStringsArgumentPosition()
static size_t getStringsArgumentPosition()
{
return 1;
}
@ -482,7 +482,7 @@ public:
}
/// Returns the position of the argument that is the column of strings
size_t getStringsArgumentPosition()
static size_t getStringsArgumentPosition()
{
return 1;
}
@ -567,7 +567,7 @@ public:
}
/// Returns the position of the argument that is the column of strings
size_t getStringsArgumentPosition()
static size_t getStringsArgumentPosition()
{
return 0;
}

View File

@ -203,7 +203,7 @@ void concat(const std::vector<std::unique_ptr<IArraySource>> & array_sources, Si
size_t sources_num = array_sources.size();
std::vector<char> is_const(sources_num);
auto checkAndGetSizeToReserve = [] (auto source, IArraySource * array_source)
auto check_and_get_size_to_reserve = [] (auto source, IArraySource * array_source)
{
if (source == nullptr)
throw Exception("Concat function expected " + demangle(typeid(Source).name()) + " or "
@ -215,17 +215,17 @@ void concat(const std::vector<std::unique_ptr<IArraySource>> & array_sources, Si
size_t size_to_reserve = 0;
for (auto i : collections::range(0, sources_num))
{
auto & source = array_sources[i];
const auto & source = array_sources[i];
is_const[i] = source->isConst();
if (is_const[i])
size_to_reserve += checkAndGetSizeToReserve(typeid_cast<ConstSource<Source> *>(source.get()), source.get());
size_to_reserve += check_and_get_size_to_reserve(typeid_cast<ConstSource<Source> *>(source.get()), source.get());
else
size_to_reserve += checkAndGetSizeToReserve(typeid_cast<Source *>(source.get()), source.get());
size_to_reserve += check_and_get_size_to_reserve(typeid_cast<Source *>(source.get()), source.get());
}
sink.reserve(size_to_reserve);
auto writeNext = [& sink] (auto source)
auto write_next = [& sink] (auto source)
{
writeSlice(source->getWhole(), sink);
source->next();
@ -235,11 +235,11 @@ void concat(const std::vector<std::unique_ptr<IArraySource>> & array_sources, Si
{
for (auto i : collections::range(0, sources_num))
{
auto & source = array_sources[i];
const auto & source = array_sources[i];
if (is_const[i])
writeNext(static_cast<ConstSource<Source> *>(source.get()));
write_next(static_cast<ConstSource<Source> *>(source.get()));
else
writeNext(static_cast<Source *>(source.get()));
write_next(static_cast<Source *>(source.get()));
}
sink.next();
}
@ -576,31 +576,31 @@ bool sliceHasImplSubstr(const FirstSliceType & first, const SecondSliceType & se
[](const SecondSliceType & pattern, size_t i, size_t j) { return isEqualUnary(pattern, i, j); });
}
size_t firstCur = 0;
size_t secondCur = 0;
while (firstCur < first.size && secondCur < second.size)
size_t first_cur = 0;
size_t second_cur = 0;
while (first_cur < first.size && second_cur < second.size)
{
const bool is_first_null = has_first_null_map && first_null_map[firstCur];
const bool is_second_null = has_second_null_map && second_null_map[secondCur];
const bool is_first_null = has_first_null_map && first_null_map[first_cur];
const bool is_second_null = has_second_null_map && second_null_map[second_cur];
const bool cond_both_null_match = is_first_null && is_second_null;
const bool cond_both_not_null = !is_first_null && !is_second_null;
if (cond_both_null_match || (cond_both_not_null && isEqual(first, second, firstCur, secondCur)))
if (cond_both_null_match || (cond_both_not_null && isEqual(first, second, first_cur, second_cur)))
{
++firstCur;
++secondCur;
++first_cur;
++second_cur;
}
else if (secondCur > 0)
else if (second_cur > 0)
{
secondCur = prefix_function[secondCur - 1];
second_cur = prefix_function[second_cur - 1];
}
else
{
++firstCur;
++first_cur;
}
}
return secondCur == second.size;
return second_cur == second.size;
}

View File

@ -131,7 +131,7 @@ struct ArrayAndValueSourceSelectorBySink : public ArraySinkSelector<ArrayAndValu
using ArraySource = typename SynkType::CompatibleArraySource;
using ValueSource = typename SynkType::CompatibleValueSource;
auto checkType = [] (auto source_ptr)
auto check_type = [] (auto source_ptr)
{
if (source_ptr == nullptr)
throw Exception(demangle(typeid(Base).name()) + " expected "
@ -141,25 +141,25 @@ struct ArrayAndValueSourceSelectorBySink : public ArraySinkSelector<ArrayAndValu
+ " or " + demangle(typeid(ConstSource<typename SynkType::CompatibleValueSource>).name())
+ " but got " + demangle(typeid(*source_ptr).name()), ErrorCodes::LOGICAL_ERROR);
};
auto checkTypeAndCallConcat = [& sink, & checkType, & 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)
{
checkType(array_source_ptr);
checkType(value_source_ptr);
check_type(array_source_ptr);
check_type(value_source_ptr);
Base::selectArrayAndValueSourceBySink(*array_source_ptr, *value_source_ptr, sink, args ...);
};
if (array_source.isConst() && value_source.isConst())
checkTypeAndCallConcat(typeid_cast<ConstSource<ArraySource> *>(&array_source),
check_type_and_call_concat(typeid_cast<ConstSource<ArraySource> *>(&array_source),
typeid_cast<ConstSource<ValueSource> *>(&value_source));
else if (array_source.isConst())
checkTypeAndCallConcat(typeid_cast<ConstSource<ArraySource> *>(&array_source),
check_type_and_call_concat(typeid_cast<ConstSource<ArraySource> *>(&array_source),
typeid_cast<ValueSource *>(&value_source));
else if (value_source.isConst())
checkTypeAndCallConcat(typeid_cast<ArraySource *>(&array_source),
check_type_and_call_concat(typeid_cast<ArraySource *>(&array_source),
typeid_cast<ConstSource<ValueSource> *>(&value_source));
else
checkTypeAndCallConcat(typeid_cast<ArraySource *>(&array_source),
check_type_and_call_concat(typeid_cast<ArraySource *>(&array_source),
typeid_cast<ValueSource *>(&value_source));
}
};

View File

@ -26,7 +26,7 @@ struct NullableSlice : public Slice
const UInt8 * null_map = nullptr;
NullableSlice() = default;
NullableSlice(const Slice & base) : Slice(base) {}
NullableSlice(const Slice & base) : Slice(base) {} /// NOLINT
};
template <typename T>

View File

@ -37,8 +37,8 @@ struct GeohashesInBoxPreparedArgs
};
GeohashesInBoxPreparedArgs geohashesInBoxPrepare(
const Float64 longitude_min,
const Float64 latitude_min,
Float64 longitude_min,
Float64 latitude_min,
Float64 longitude_max,
Float64 latitude_max,
uint8_t precision);

View File

@ -32,13 +32,13 @@ namespace DB
/** Construct from date in text form 'YYYY-MM-DD' by reading from
* ReadBuffer.
*/
GregorianDate(ReadBuffer & in);
explicit GregorianDate(ReadBuffer & in);
/** Construct from Modified Julian Day. The type T is an
* integral type which should be at least 32 bits wide, and
* should preferably signed.
*/
GregorianDate(is_integer auto mjd);
explicit GregorianDate(is_integer auto mjd);
/** Convert to Modified Julian Day. The type T is an integral type
* which should be at least 32 bits wide, and should preferably
@ -65,15 +65,15 @@ namespace DB
return month_;
}
uint8_t day_of_month() const noexcept
uint8_t day_of_month() const noexcept /// NOLINT
{
return day_of_month_;
}
private:
YearT year_;
uint8_t month_;
uint8_t day_of_month_;
YearT year_; /// NOLINT
uint8_t month_; /// NOLINT
uint8_t day_of_month_; /// NOLINT
};
/** ISO 8601 Ordinal Date. YearT is an integral type which should
@ -89,7 +89,7 @@ namespace DB
* integral type which should be at least 32 bits wide, and
* should preferably signed.
*/
OrdinalDate(is_integer auto mjd);
explicit OrdinalDate(is_integer auto mjd);
/** Convert to Modified Julian Day. The type T is an integral
* type which should be at least 32 bits wide, and should
@ -109,8 +109,8 @@ namespace DB
}
private:
YearT year_;
uint16_t day_of_year_;
YearT year_; /// NOLINT
uint16_t day_of_year_; /// NOLINT
};
class MonthDay
@ -134,14 +134,14 @@ namespace DB
return month_;
}
uint8_t day_of_month() const noexcept
uint8_t day_of_month() const noexcept /// NOLINT
{
return day_of_month_;
}
private:
uint8_t month_;
uint8_t day_of_month_;
uint8_t month_; /// NOLINT
uint8_t day_of_month_; /// NOLINT
};
}
@ -183,13 +183,13 @@ namespace gd
template <typename I, typename J>
static inline constexpr I div(I x, J y)
{
const auto y_ = static_cast<I>(y);
if (x > 0 && y_ < 0)
return ((x - 1) / y_) - 1;
else if (x < 0 && y_ > 0)
return ((x + 1) / y_) - 1;
const auto y_cast = static_cast<I>(y);
if (x > 0 && y_cast < 0)
return ((x - 1) / y_cast) - 1;
else if (x < 0 && y_cast > 0)
return ((x + 1) / y_cast) - 1;
else
return x / y_;
return x / y_cast;
}
/** Integer modulus, satisfying div(x, y)*y + mod(x, y) == x.
@ -197,10 +197,10 @@ namespace gd
template <typename I, typename J>
static inline constexpr I mod(I x, J y)
{
const auto y_ = static_cast<I>(y);
const auto r = x % y_;
if ((x > 0 && y_ < 0) || (x < 0 && y_ > 0))
return r == 0 ? static_cast<I>(0) : r + y_;
const auto y_cast = static_cast<I>(y);
const auto r = x % y_cast;
if ((x > 0 && y_cast < 0) || (x < 0 && y_cast > 0))
return r == 0 ? static_cast<I>(0) : r + y_cast;
else
return r;
}
@ -210,8 +210,8 @@ namespace gd
template <typename I, typename J>
static inline constexpr I min(I x, J y)
{
const auto y_ = static_cast<I>(y);
return x < y_ ? x : y_;
const auto y_cast = static_cast<I>(y);
return x < y_cast ? x : y_cast;
}
static inline char readDigit(ReadBuffer & in)

View File

@ -120,7 +120,7 @@ public:
virtual ~IFunctionBase() = default;
virtual ColumnPtr execute(
virtual ColumnPtr execute( /// NOLINT
const ColumnsWithTypeAndName & arguments, const DataTypePtr & result_type, size_t input_rows_count, bool dry_run = false) const
{
return prepare(arguments)->execute(arguments, result_type, input_rows_count, dry_run);

View File

@ -1,6 +1,11 @@
#pragma once
#include <Columns/ColumnConst.h>
#include <Columns/ColumnTuple.h>
#include <Functions/IFunction.h>
#include <Functions/FunctionHelpers.h>
#include <Interpreters/Context_fwd.h>
namespace DB
{

View File

@ -11,7 +11,6 @@ public:
ASTPtr clone() const override { return std::make_shared<ASTJSONPathMemberAccess>(*this); }
public:
/// Member name to lookup in json document (in path: $.some_key.another_key. ...)
String member_name;
};

View File

@ -12,7 +12,6 @@ public:
ASTPtr clone() const override { return std::make_shared<ASTJSONPathRange>(*this); }
public:
/// Ranges to lookup in json array ($[0, 1, 2, 4 to 9])
/// Range is represented as <start, end (non-inclusive)>
/// Single index is represented as <start, start + 1>

View File

@ -25,7 +25,7 @@ public:
* Traverses children ASTs of ASTJSONPathQuery and creates a vector of corresponding visitors
* @param query_ptr_ pointer to ASTJSONPathQuery
*/
GeneratorJSONPath(ASTPtr query_ptr_)
explicit GeneratorJSONPath(ASTPtr query_ptr_)
{
query_ptr = query_ptr_;
const auto * path = query_ptr->as<ASTJSONPath>();

View File

@ -10,7 +10,7 @@ template <typename JSONParser>
class VisitorJSONPathMemberAccess : public IVisitor<JSONParser>
{
public:
VisitorJSONPathMemberAccess(ASTPtr member_access_ptr_)
explicit VisitorJSONPathMemberAccess(ASTPtr member_access_ptr_)
: member_access_ptr(member_access_ptr_->as<ASTJSONPathMemberAccess>()) { }
const char * getName() const override { return "VisitorJSONPathMemberAccess"; }

View File

@ -10,7 +10,7 @@ template <typename JSONParser>
class VisitorJSONPathRange : public IVisitor<JSONParser>
{
public:
VisitorJSONPathRange(ASTPtr range_ptr_) : range_ptr(range_ptr_->as<ASTJSONPathRange>())
explicit VisitorJSONPathRange(ASTPtr range_ptr_) : range_ptr(range_ptr_->as<ASTJSONPathRange>())
{
current_range = 0;
current_index = range_ptr->ranges[current_range].first;
@ -20,7 +20,6 @@ public:
VisitorStatus apply(typename JSONParser::Element & element) const override
{
typename JSONParser::Element result;
typename JSONParser::Array array = element.getArray();
element = array[current_index];
return VisitorStatus::Ok;

View File

@ -10,7 +10,7 @@ template <typename JSONParser>
class VisitorJSONPathRoot : public IVisitor<JSONParser>
{
public:
VisitorJSONPathRoot(ASTPtr) { }
explicit VisitorJSONPathRoot(ASTPtr) { }
const char * getName() const override { return "VisitorJSONPathRoot"; }

View File

@ -10,7 +10,7 @@ template <typename JSONParser>
class VisitorJSONPathStar : public IVisitor<JSONParser>
{
public:
VisitorJSONPathStar(ASTPtr)
explicit VisitorJSONPathStar(ASTPtr)
{
current_index = 0;
}
@ -19,7 +19,6 @@ public:
VisitorStatus apply(typename JSONParser::Element & element) const override
{
typename JSONParser::Element result;
typename JSONParser::Array array = element.getArray();
element = array[current_index];
return VisitorStatus::Ok;

View File

@ -12,6 +12,7 @@
#include <Functions/GatherUtils/Slices.h>
#include <Functions/GatherUtils/Algorithms.h>
#include <IO/WriteHelpers.h>
#include <Interpreters/Context_fwd.h>
namespace DB

View File

@ -31,7 +31,7 @@ private:
#ifdef __SSE2__
const auto bytes_sse = sizeof(__m128i);
const auto src_end_sse = src_end - (src_end - src) % bytes_sse;
const auto * src_end_sse = src_end - (src_end - src) % bytes_sse;
const auto v_not_case_lower_bound = _mm_set1_epi8(not_case_lower_bound - 1);
const auto v_not_case_upper_bound = _mm_set1_epi8(not_case_upper_bound + 1);

View File

@ -16,61 +16,58 @@ namespace ErrorCodes
extern const int BAD_ARGUMENTS;
}
namespace
/// xor or do nothing
template <bool>
UInt8 xor_or_identity(const UInt8 c, const int mask)
{
/// xor or do nothing
template <bool>
UInt8 xor_or_identity(const UInt8 c, const int mask)
{
return c ^ mask;
}
return c ^ mask;
}
template <>
inline UInt8 xor_or_identity<false>(const UInt8 c, const int)
{
return c;
}
template <>
inline UInt8 xor_or_identity<false>(const UInt8 c, const int)
{
return c;
}
/// It is caller's responsibility to ensure the presence of a valid cyrillic sequence in array
template <bool to_lower>
inline void UTF8CyrillicToCase(const UInt8 *& src, UInt8 *& dst)
/// It is caller's responsibility to ensure the presence of a valid cyrillic sequence in array
template <bool to_lower>
inline void UTF8CyrillicToCase(const UInt8 *& src, UInt8 *& dst)
{
if (src[0] == 0xD0u && (src[1] >= 0x80u && src[1] <= 0x8Fu))
{
if (src[0] == 0xD0u && (src[1] >= 0x80u && src[1] <= 0x8Fu))
{
/// ЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏ
*dst++ = xor_or_identity<to_lower>(*src++, 0x1);
*dst++ = xor_or_identity<to_lower>(*src++, 0x10);
}
else if (src[0] == 0xD1u && (src[1] >= 0x90u && src[1] <= 0x9Fu))
{
/// ѐёђѓєѕіїјљњћќѝўџ
*dst++ = xor_or_identity<!to_lower>(*src++, 0x1);
*dst++ = xor_or_identity<!to_lower>(*src++, 0x10);
}
else if (src[0] == 0xD0u && (src[1] >= 0x90u && src[1] <= 0x9Fu))
{
/// А
*dst++ = *src++;
*dst++ = xor_or_identity<to_lower>(*src++, 0x20);
}
else if (src[0] == 0xD0u && (src[1] >= 0xB0u && src[1] <= 0xBFu))
{
/// а-п
*dst++ = *src++;
*dst++ = xor_or_identity<!to_lower>(*src++, 0x20);
}
else if (src[0] == 0xD0u && (src[1] >= 0xA0u && src[1] <= 0xAFu))
{
/// Р
*dst++ = xor_or_identity<to_lower>(*src++, 0x1);
*dst++ = xor_or_identity<to_lower>(*src++, 0x20);
}
else if (src[0] == 0xD1u && (src[1] >= 0x80u && src[1] <= 0x8Fu))
{
/// р
*dst++ = xor_or_identity<!to_lower>(*src++, 0x1);
*dst++ = xor_or_identity<!to_lower>(*src++, 0x20);
}
/// ЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏ
*dst++ = xor_or_identity<to_lower>(*src++, 0x1);
*dst++ = xor_or_identity<to_lower>(*src++, 0x10);
}
else if (src[0] == 0xD1u && (src[1] >= 0x90u && src[1] <= 0x9Fu))
{
/// ѐёђѓєѕіїјљњћќѝўџ
*dst++ = xor_or_identity<!to_lower>(*src++, 0x1);
*dst++ = xor_or_identity<!to_lower>(*src++, 0x10);
}
else if (src[0] == 0xD0u && (src[1] >= 0x90u && src[1] <= 0x9Fu))
{
/// А
*dst++ = *src++;
*dst++ = xor_or_identity<to_lower>(*src++, 0x20);
}
else if (src[0] == 0xD0u && (src[1] >= 0xB0u && src[1] <= 0xBFu))
{
/// а-п
*dst++ = *src++;
*dst++ = xor_or_identity<!to_lower>(*src++, 0x20);
}
else if (src[0] == 0xD0u && (src[1] >= 0xA0u && src[1] <= 0xAFu))
{
/// Р
*dst++ = xor_or_identity<to_lower>(*src++, 0x1);
*dst++ = xor_or_identity<to_lower>(*src++, 0x20);
}
else if (src[0] == 0xD1u && (src[1] >= 0x80u && src[1] <= 0x8Fu))
{
/// р
*dst++ = xor_or_identity<!to_lower>(*src++, 0x1);
*dst++ = xor_or_identity<!to_lower>(*src++, 0x20);
}
}
@ -171,7 +168,7 @@ private:
{
#ifdef __SSE2__
static constexpr auto bytes_sse = sizeof(__m128i);
auto src_end_sse = src + (src_end - src) / bytes_sse * bytes_sse;
const auto * src_end_sse = src + (src_end - src) / bytes_sse * bytes_sse;
/// SSE2 packed comparison operate on signed types, hence compare (c < 0) instead of (c > 0x7f)
const auto v_zero = _mm_setzero_si128();
@ -216,7 +213,7 @@ private:
else
{
/// UTF-8
const auto expected_end = src + bytes_sse;
const auto * expected_end = src + bytes_sse;
while (src < expected_end)
toCase(src, src_end, dst);

View File

@ -3,6 +3,7 @@
#include <base/types.h>
#include <Columns/ColumnString.h>
#include <DataTypes/DataTypesNumber.h>
#include <DataTypes/DataTypeArray.h>
#include "Regexps.h"
#include "config_functions.h"

View File

@ -72,7 +72,7 @@ namespace detail
return size() == 0;
}
void emplace_back()
void emplace_back() /// NOLINT
{
data.emplace_back();
}
@ -198,7 +198,7 @@ class ImplementationSelector : WithContext
public:
using ImplementationPtr = std::shared_ptr<FunctionInterface>;
ImplementationSelector(ContextPtr context_) : WithContext(context_) {}
explicit ImplementationSelector(ContextPtr context_) : WithContext(context_) {}
/* Select the best implementation based on previous runs.
* If FunctionInterface is IFunction, then "executeImpl" method of the implementation will be called

View File

@ -53,14 +53,14 @@ UInt64 getPolygonAllocatedBytes(const Polygon & polygon)
using RingType = typename Polygon::ring_type;
using ValueType = typename RingType::value_type;
auto sizeOfRing = [](const RingType & ring) { return sizeof(ring) + ring.capacity() * sizeof(ValueType); };
auto size_of_ring = [](const RingType & ring) { return sizeof(ring) + ring.capacity() * sizeof(ValueType); };
size += sizeOfRing(polygon.outer());
size += size_of_ring(polygon.outer());
const auto & inners = polygon.inners();
size += sizeof(inners) + inners.capacity() * sizeof(RingType);
for (auto & inner : inners)
size += sizeOfRing(inner);
size += size_of_ring(inner);
return size;
}

View File

@ -23,8 +23,8 @@ struct RapidJSONParser
class Element
{
public:
ALWAYS_INLINE Element() {}
ALWAYS_INLINE Element(const rapidjson::Value & value_) : ptr(&value_) {}
ALWAYS_INLINE Element() = default;
ALWAYS_INLINE Element(const rapidjson::Value & value_) : ptr(&value_) {} /// NOLINT
ALWAYS_INLINE bool isInt64() const { return ptr->IsInt64(); }
ALWAYS_INLINE bool isUInt64() const { return ptr->IsUint64(); }
@ -54,17 +54,17 @@ struct RapidJSONParser
class Iterator
{
public:
ALWAYS_INLINE Iterator(const rapidjson::Value::ConstValueIterator & it_) : it(it_) {}
ALWAYS_INLINE Element operator*() const { return *it; }
ALWAYS_INLINE Iterator(const rapidjson::Value::ConstValueIterator & it_) : it(it_) {} /// NOLINT
ALWAYS_INLINE Element operator*() const { return *it; } /// NOLINT
ALWAYS_INLINE Iterator & operator ++() { ++it; return *this; }
ALWAYS_INLINE Iterator operator ++(int) { auto res = *this; ++it; return res; }
ALWAYS_INLINE Iterator operator ++(int) { auto res = *this; ++it; return res; } /// NOLINT
ALWAYS_INLINE friend bool operator ==(const Iterator & left, const Iterator & right) { return left.it == right.it; }
ALWAYS_INLINE friend bool operator !=(const Iterator & left, const Iterator & right) { return !(left == right); }
private:
rapidjson::Value::ConstValueIterator it;
};
ALWAYS_INLINE Array(const rapidjson::Value & value_) : ptr(&value_) {}
ALWAYS_INLINE Array(const rapidjson::Value & value_) : ptr(&value_) {} /// NOLINT
ALWAYS_INLINE Iterator begin() const { return ptr->Begin(); }
ALWAYS_INLINE Iterator end() const { return ptr->End(); }
ALWAYS_INLINE size_t size() const { return ptr->Size(); }
@ -83,17 +83,17 @@ struct RapidJSONParser
class Iterator
{
public:
ALWAYS_INLINE Iterator(const rapidjson::Value::ConstMemberIterator & it_) : it(it_) {}
ALWAYS_INLINE Iterator(const rapidjson::Value::ConstMemberIterator & it_) : it(it_) {} /// NOLINT
ALWAYS_INLINE KeyValuePair operator *() const { std::string_view key{it->name.GetString(), it->name.GetStringLength()}; return {key, it->value}; }
ALWAYS_INLINE Iterator & operator ++() { ++it; return *this; }
ALWAYS_INLINE Iterator operator ++(int) { auto res = *this; ++it; return res; }
ALWAYS_INLINE Iterator operator ++(int) { auto res = *this; ++it; return res; } /// NOLINT
ALWAYS_INLINE friend bool operator ==(const Iterator & left, const Iterator & right) { return left.it == right.it; }
ALWAYS_INLINE friend bool operator !=(const Iterator & left, const Iterator & right) { return !(left == right); }
private:
rapidjson::Value::ConstMemberIterator it;
};
ALWAYS_INLINE Object(const rapidjson::Value & value_) : ptr(&value_) {}
ALWAYS_INLINE Object(const rapidjson::Value & value_) : ptr(&value_) {} /// NOLINT
ALWAYS_INLINE Iterator begin() const { return ptr->MemberBegin(); }
ALWAYS_INLINE Iterator end() const { return ptr->MemberEnd(); }
ALWAYS_INLINE size_t size() const { return ptr->MemberCount(); }

View File

@ -33,8 +33,8 @@ struct ReplaceRegexpImpl
/// Otherwise - paste this string verbatim.
std::string literal;
Instruction(int substitution_num_) : substitution_num(substitution_num_) {}
Instruction(std::string literal_) : literal(std::move(literal_)) {}
Instruction(int substitution_num_) : substitution_num(substitution_num_) {} /// NOLINT
Instruction(std::string literal_) : literal(std::move(literal_)) {} /// NOLINT
};
using Instructions = std::vector<Instruction>;

View File

@ -28,8 +28,8 @@ struct SimdJSONParser
class Element
{
public:
ALWAYS_INLINE Element() {}
ALWAYS_INLINE Element(const simdjson::dom::element & element_) : element(element_) {}
ALWAYS_INLINE Element() {} /// NOLINT
ALWAYS_INLINE Element(const simdjson::dom::element & element_) : element(element_) {} /// NOLINT
ALWAYS_INLINE bool isInt64() const { return element.type() == simdjson::dom::element_type::INT64; }
ALWAYS_INLINE bool isUInt64() const { return element.type() == simdjson::dom::element_type::UINT64; }
@ -61,17 +61,17 @@ struct SimdJSONParser
class Iterator
{
public:
ALWAYS_INLINE Iterator(const simdjson::dom::array::iterator & it_) : it(it_) {}
ALWAYS_INLINE Iterator(const simdjson::dom::array::iterator & it_) : it(it_) {} /// NOLINT
ALWAYS_INLINE Element operator*() const { return *it; }
ALWAYS_INLINE Iterator & operator++() { ++it; return *this; }
ALWAYS_INLINE Iterator operator++(int) { auto res = *this; ++it; return res; }
ALWAYS_INLINE Iterator operator++(int) { auto res = *this; ++it; return res; } /// NOLINT
ALWAYS_INLINE friend bool operator!=(const Iterator & left, const Iterator & right) { return left.it != right.it; }
ALWAYS_INLINE friend bool operator==(const Iterator & left, const Iterator & right) { return !(left != right); }
private:
simdjson::dom::array::iterator it;
};
ALWAYS_INLINE Array(const simdjson::dom::array & array_) : array(array_) {}
ALWAYS_INLINE Array(const simdjson::dom::array & array_) : array(array_) {} /// NOLINT
ALWAYS_INLINE Iterator begin() const { return array.begin(); }
ALWAYS_INLINE Iterator end() const { return array.end(); }
ALWAYS_INLINE size_t size() const { return array.size(); }
@ -90,17 +90,17 @@ struct SimdJSONParser
class Iterator
{
public:
ALWAYS_INLINE Iterator(const simdjson::dom::object::iterator & it_) : it(it_) {}
ALWAYS_INLINE Iterator(const simdjson::dom::object::iterator & it_) : it(it_) {} /// NOLINT
ALWAYS_INLINE KeyValuePair operator*() const { const auto & res = *it; return {res.key, res.value}; }
ALWAYS_INLINE Iterator & operator++() { ++it; return *this; }
ALWAYS_INLINE Iterator operator++(int) { auto res = *this; ++it; return res; }
ALWAYS_INLINE Iterator operator++(int) { auto res = *this; ++it; return res; } /// NOLINT
ALWAYS_INLINE friend bool operator!=(const Iterator & left, const Iterator & right) { return left.it != right.it; }
ALWAYS_INLINE friend bool operator==(const Iterator & left, const Iterator & right) { return !(left != right); }
private:
simdjson::dom::object::iterator it;
};
ALWAYS_INLINE Object(const simdjson::dom::object & object_) : object(object_) {}
ALWAYS_INLINE Object(const simdjson::dom::object & object_) : object(object_) {} /// NOLINT
ALWAYS_INLINE Iterator begin() const { return object.begin(); }
ALWAYS_INLINE Iterator end() const { return object.end(); }
ALWAYS_INLINE size_t size() const { return object.size(); }

View File

@ -89,6 +89,7 @@ String toString(TargetArch arch);
#if ENABLE_MULTITARGET_CODE && defined(__GNUC__) && defined(__x86_64__)
/// NOLINTNEXTLINE
#define USE_MULTITARGET_CODE 1
#if defined(__clang__)
@ -183,6 +184,7 @@ namespace TargetSpecific::Default { \
__VA_ARGS__ \
}
/// NOLINTNEXTLINE
#define DECLARE_MULTITARGET_CODE(...) \
DECLARE_DEFAULT_CODE (__VA_ARGS__) \
DECLARE_SSE42_SPECIFIC_CODE (__VA_ARGS__) \
@ -191,23 +193,23 @@ DECLARE_AVX2_SPECIFIC_CODE (__VA_ARGS__) \
DECLARE_AVX512F_SPECIFIC_CODE(__VA_ARGS__)
DECLARE_DEFAULT_CODE(
constexpr auto BuildArch = TargetArch::Default;
constexpr auto BuildArch = TargetArch::Default; /// NOLINT
) // DECLARE_DEFAULT_CODE
DECLARE_SSE42_SPECIFIC_CODE(
constexpr auto BuildArch = TargetArch::SSE42;
constexpr auto BuildArch = TargetArch::SSE42; /// NOLINT
) // DECLARE_SSE42_SPECIFIC_CODE
DECLARE_AVX_SPECIFIC_CODE(
constexpr auto BuildArch = TargetArch::AVX;
constexpr auto BuildArch = TargetArch::AVX; /// NOLINT
) // DECLARE_AVX_SPECIFIC_CODE
DECLARE_AVX2_SPECIFIC_CODE(
constexpr auto BuildArch = TargetArch::AVX2;
constexpr auto BuildArch = TargetArch::AVX2; /// NOLINT
) // DECLARE_AVX2_SPECIFIC_CODE
DECLARE_AVX512F_SPECIFIC_CODE(
constexpr auto BuildArch = TargetArch::AVX512F;
constexpr auto BuildArch = TargetArch::AVX512F; /// NOLINT
) // DECLARE_AVX512F_SPECIFIC_CODE
}

View File

@ -44,7 +44,7 @@ public:
static constexpr auto name = Transform::name;
// non-explicit constructor to allow creating from scale value (or with no scale at all), indispensable in some contexts.
TransformDateTime64(UInt32 scale_ = 0)
TransformDateTime64(UInt32 scale_ = 0) /// NOLINT
: scale_multiplier(DecimalUtils::scaleMultiplier<DateTime64::NativeType>(scale_))
{}

View File

@ -49,11 +49,11 @@ struct ExtractFirstSignificantSubdomain
res_data = tmp;
res_size = domain_length;
auto begin = tmp;
auto end = begin + domain_length;
const auto * begin = tmp;
const auto * end = begin + domain_length;
const char * last_3_periods[3]{};
auto pos = find_first_symbols<'.'>(begin, end);
const auto * pos = find_first_symbols<'.'>(begin, end);
while (pos < end)
{
last_3_periods[2] = last_3_periods[1];
@ -74,7 +74,7 @@ struct ExtractFirstSignificantSubdomain
if (!last_3_periods[2])
last_3_periods[2] = begin - 1;
auto end_of_level_domain = find_first_symbols<'/'>(last_3_periods[0], end);
const auto * end_of_level_domain = find_first_symbols<'/'>(last_3_periods[0], end);
if (!end_of_level_domain)
{
end_of_level_domain = end;
@ -117,12 +117,12 @@ struct ExtractFirstSignificantSubdomain
res_data = tmp;
res_size = domain_length;
auto begin = tmp;
auto end = begin + domain_length;
const auto * begin = tmp;
const auto * end = begin + domain_length;
const char * last_2_periods[2]{};
const char * prev = begin - 1;
auto pos = find_first_symbols<'.'>(begin, end);
const auto * pos = find_first_symbols<'.'>(begin, end);
while (pos < end)
{
if (lookup(pos + 1, end - pos - 1))

View File

@ -20,7 +20,7 @@ namespace ErrorCodes
struct FirstSignificantSubdomainCustomLookup
{
const TLDList & tld_list;
FirstSignificantSubdomainCustomLookup(const std::string & tld_list_name)
explicit FirstSignificantSubdomainCustomLookup(const std::string & tld_list_name)
: tld_list(TLDListsHolder::getInstance().getTldList(tld_list_name))
{
}

View File

@ -8,9 +8,6 @@
namespace DB
{
namespace
{
inline StringRef checkAndReturnHost(const Pos & pos, const Pos & dot_pos, const Pos & start_of_host)
{
if (!dot_pos || start_of_host >= pos || pos - dot_pos == 1)
@ -23,8 +20,6 @@ inline StringRef checkAndReturnHost(const Pos & pos, const Pos & dot_pos, const
return StringRef(start_of_host, pos - start_of_host);
}
}
/// Extracts host from given url.
///
/// @return empty StringRef if the host is not valid (i.e. it does not have dot, or there no symbol after dot).
@ -79,7 +74,7 @@ exloop: if ((scheme_end - pos) > 2 && *pos == ':' && *(pos + 1) == '/' && *(pos
}
Pos dot_pos = nullptr;
auto start_of_host = pos;
const auto * start_of_host = pos;
for (; pos < end; ++pos)
{
switch (*pos)

View File

@ -6,27 +6,27 @@
namespace DB::VectorExtension
{
typedef UInt64 UInt64x2 __attribute__ ((vector_size (sizeof(UInt64) * 2)));
typedef UInt64 UInt64x4 __attribute__ ((vector_size (sizeof(UInt64) * 4)));
typedef UInt64 UInt64x8 __attribute__ ((vector_size (sizeof(UInt64) * 8)));
using UInt64x2 = UInt64 __attribute__ ((vector_size (sizeof(UInt64) * 2)));
using UInt64x4 = UInt64 __attribute__ ((vector_size (sizeof(UInt64) * 4)));
using UInt64x8 = UInt64 __attribute__ ((vector_size (sizeof(UInt64) * 8)));
typedef UInt32 UInt32x2 __attribute__ ((vector_size (sizeof(UInt32) * 2)));
typedef UInt32 UInt32x4 __attribute__ ((vector_size (sizeof(UInt32) * 4)));
typedef UInt32 UInt32x8 __attribute__ ((vector_size (sizeof(UInt32) * 8)));
typedef UInt32 UInt32x16 __attribute__ ((vector_size (sizeof(UInt32) * 16)));
using UInt32x2 = UInt32 __attribute__ ((vector_size (sizeof(UInt32) * 2)));
using UInt32x4 = UInt32 __attribute__ ((vector_size (sizeof(UInt32) * 4)));
using UInt32x8 = UInt32 __attribute__ ((vector_size (sizeof(UInt32) * 8)));
using UInt32x16 = UInt32 __attribute__ ((vector_size (sizeof(UInt32) * 16)));
typedef UInt16 UInt16x2 __attribute__ ((vector_size (sizeof(UInt16) * 2)));
typedef UInt16 UInt16x4 __attribute__ ((vector_size (sizeof(UInt16) * 4)));
typedef UInt16 UInt16x8 __attribute__ ((vector_size (sizeof(UInt16) * 8)));
typedef UInt16 UInt16x16 __attribute__ ((vector_size (sizeof(UInt16) * 16)));
typedef UInt16 UInt16x32 __attribute__ ((vector_size (sizeof(UInt16) * 32)));
using UInt16x2 = UInt16 __attribute__ ((vector_size (sizeof(UInt16) * 2)));
using UInt16x4 = UInt16 __attribute__ ((vector_size (sizeof(UInt16) * 4)));
using UInt16x8 = UInt16 __attribute__ ((vector_size (sizeof(UInt16) * 8)));
using UInt16x16 = UInt16 __attribute__ ((vector_size (sizeof(UInt16) * 16)));
using UInt16x32 = UInt16 __attribute__ ((vector_size (sizeof(UInt16) * 32)));
typedef UInt8 UInt8x2 __attribute__ ((vector_size (sizeof(UInt8) * 2)));
typedef UInt8 UInt8x4 __attribute__ ((vector_size (sizeof(UInt8) * 4)));
typedef UInt8 UInt8x8 __attribute__ ((vector_size (sizeof(UInt8) * 8)));
typedef UInt8 UInt8x16 __attribute__ ((vector_size (sizeof(UInt8) * 16)));
typedef UInt8 UInt8x32 __attribute__ ((vector_size (sizeof(UInt8) * 32)));
typedef UInt8 UInt8x64 __attribute__ ((vector_size (sizeof(UInt8) * 64)));
using UInt8x2 = UInt8 __attribute__ ((vector_size (sizeof(UInt8) * 2)));
using UInt8x4 = UInt8 __attribute__ ((vector_size (sizeof(UInt8) * 4)));
using UInt8x8 = UInt8 __attribute__ ((vector_size (sizeof(UInt8) * 8)));
using UInt8x16 = UInt8 __attribute__ ((vector_size (sizeof(UInt8) * 16)));
using UInt8x32 = UInt8 __attribute__ ((vector_size (sizeof(UInt8) * 32)));
using UInt8x64 = UInt8 __attribute__ ((vector_size (sizeof(UInt8) * 64)));
namespace detail
{

View File

@ -252,7 +252,7 @@ ColumnPtr FunctionArrayEnumerateRankedExtended<Derived>::executeImpl(
ColumnPtr result_nested_array = std::move(res_nested);
for (ssize_t depth = arrays_depths.max_array_depth - 1; depth >= 0; --depth)
result_nested_array = ColumnArray::create(std::move(result_nested_array), offsetsptr_by_depth[depth]);
result_nested_array = ColumnArray::create(result_nested_array, offsetsptr_by_depth[depth]);
return result_nested_array;
}

View File

@ -432,7 +432,7 @@ public:
const auto & map_array_column = map_column.getNestedColumn();
auto offsets = map_array_column.getOffsetsPtr();
auto keys = map_column.getNestedData().getColumnPtr(0);
auto array_column = ColumnArray::create(std::move(keys), std::move(offsets));
auto array_column = ColumnArray::create(keys, offsets);
const auto & type_map = assert_cast<const DataTypeMap &>(*arguments[0].type);
auto array_type = std::make_shared<DataTypeArray>(type_map.getKeyType());

View File

@ -5,6 +5,7 @@
#include <DataTypes/DataTypeArray.h>
#include <Functions/FunctionHelpers.h>
#include <Functions/IFunction.h>
#include <Interpreters/Context_fwd.h>
namespace DB

View File

@ -44,7 +44,7 @@ public:
{
for (auto i : collections::range(0, arguments.size()))
{
auto array_type = typeid_cast<const DataTypeArray *>(arguments[i].get());
const auto * array_type = typeid_cast<const DataTypeArray *>(arguments[i].get());
if (!array_type)
throw Exception("Argument " + std::to_string(i) + " for function " + getName() + " must be an array but it has type "
+ arguments[i]->getName() + ".", ErrorCodes::ILLEGAL_TYPE_OF_ARGUMENT);

View File

@ -55,7 +55,7 @@ public:
static constexpr auto Kind = Impl::Kind;
static constexpr auto name = Impl::Name;
FunctionExtractAllGroups(ContextPtr context_)
explicit FunctionExtractAllGroups(ContextPtr context_)
: context(context_)
{}

View File

@ -7,6 +7,7 @@
#include <DataTypes/DataTypeString.h>
#include <IO/WriteBufferFromVector.h>
#include <IO/WriteHelpers.h>
#include <Interpreters/Context_fwd.h>
namespace DB

View File

@ -8,6 +8,7 @@
#include <Columns/ColumnsNumber.h>
#include <Columns/ColumnNullable.h>
#include <IO/WriteHelpers.h>
#include <Interpreters/Context_fwd.h>
namespace DB