mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
Fix clang-tidy "-readability-redundant-inline-specifier"
This commit is contained in:
parent
3878155b19
commit
113bb00005
@ -129,7 +129,6 @@ Checks: [
|
|||||||
'-readability-avoid-nested-conditional-operator',
|
'-readability-avoid-nested-conditional-operator',
|
||||||
'-modernize-use-designated-initializers',
|
'-modernize-use-designated-initializers',
|
||||||
'-performance-enum-size',
|
'-performance-enum-size',
|
||||||
'-readability-redundant-inline-specifier',
|
|
||||||
'-readability-redundant-member-init',
|
'-readability-redundant-member-init',
|
||||||
'-bugprone-crtp-constructor-accessibility',
|
'-bugprone-crtp-constructor-accessibility',
|
||||||
'-bugprone-suspicious-stringview-data-usage',
|
'-bugprone-suspicious-stringview-data-usage',
|
||||||
|
@ -86,7 +86,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Return object into pool. Client must return same object that was borrowed.
|
/// Return object into pool. Client must return same object that was borrowed.
|
||||||
inline void returnObject(T && object_to_return)
|
void returnObject(T && object_to_return)
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
std::lock_guard lock(objects_mutex);
|
std::lock_guard lock(objects_mutex);
|
||||||
@ -99,20 +99,20 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Max pool size
|
/// Max pool size
|
||||||
inline size_t maxSize() const
|
size_t maxSize() const
|
||||||
{
|
{
|
||||||
return max_size;
|
return max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Allocated objects size by the pool. If allocatedObjectsSize == maxSize then pool is full.
|
/// Allocated objects size by the pool. If allocatedObjectsSize == maxSize then pool is full.
|
||||||
inline size_t allocatedObjectsSize() const
|
size_t allocatedObjectsSize() const
|
||||||
{
|
{
|
||||||
std::lock_guard lock(objects_mutex);
|
std::lock_guard lock(objects_mutex);
|
||||||
return allocated_objects_size;
|
return allocated_objects_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns allocatedObjectsSize == maxSize
|
/// Returns allocatedObjectsSize == maxSize
|
||||||
inline bool isFull() const
|
bool isFull() const
|
||||||
{
|
{
|
||||||
std::lock_guard lock(objects_mutex);
|
std::lock_guard lock(objects_mutex);
|
||||||
return allocated_objects_size == max_size;
|
return allocated_objects_size == max_size;
|
||||||
@ -120,7 +120,7 @@ public:
|
|||||||
|
|
||||||
/// Borrowed objects size. If borrowedObjectsSize == allocatedObjectsSize and pool is full.
|
/// Borrowed objects size. If borrowedObjectsSize == allocatedObjectsSize and pool is full.
|
||||||
/// Then client will wait during borrowObject function call.
|
/// Then client will wait during borrowObject function call.
|
||||||
inline size_t borrowedObjectsSize() const
|
size_t borrowedObjectsSize() const
|
||||||
{
|
{
|
||||||
std::lock_guard lock(objects_mutex);
|
std::lock_guard lock(objects_mutex);
|
||||||
return borrowed_objects_size;
|
return borrowed_objects_size;
|
||||||
@ -129,7 +129,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
template <typename FactoryFunc>
|
template <typename FactoryFunc>
|
||||||
inline T allocateObjectForBorrowing(const std::unique_lock<std::mutex> &, FactoryFunc && func)
|
T allocateObjectForBorrowing(const std::unique_lock<std::mutex> &, FactoryFunc && func)
|
||||||
{
|
{
|
||||||
++allocated_objects_size;
|
++allocated_objects_size;
|
||||||
++borrowed_objects_size;
|
++borrowed_objects_size;
|
||||||
@ -137,7 +137,7 @@ private:
|
|||||||
return std::forward<FactoryFunc>(func)();
|
return std::forward<FactoryFunc>(func)();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline T borrowFromObjects(const std::unique_lock<std::mutex> &)
|
T borrowFromObjects(const std::unique_lock<std::mutex> &)
|
||||||
{
|
{
|
||||||
T dst;
|
T dst;
|
||||||
detail::moveOrCopyIfThrow(std::move(objects.back()), dst);
|
detail::moveOrCopyIfThrow(std::move(objects.back()), dst);
|
||||||
|
@ -23,7 +23,7 @@ public:
|
|||||||
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
void handleRequest(HTTPServerRequest & request, HTTPServerResponse & response, const ProfileEvents::Event & write_event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr inline auto FORMAT = "RowBinary";
|
static constexpr auto FORMAT = "RowBinary";
|
||||||
|
|
||||||
const size_t keep_alive_timeout;
|
const size_t keep_alive_timeout;
|
||||||
LoggerPtr log;
|
LoggerPtr log;
|
||||||
|
@ -56,10 +56,10 @@ private:
|
|||||||
std::condition_variable cond;
|
std::condition_variable cond;
|
||||||
std::optional<ThreadFromGlobalPool> thread;
|
std::optional<ThreadFromGlobalPool> thread;
|
||||||
|
|
||||||
static inline constexpr auto profile_events_path_prefix = "ClickHouse.ProfileEvents.";
|
static constexpr auto profile_events_path_prefix = "ClickHouse.ProfileEvents.";
|
||||||
static inline constexpr auto profile_events_cumulative_path_prefix = "ClickHouse.ProfileEventsCumulative.";
|
static constexpr auto profile_events_cumulative_path_prefix = "ClickHouse.ProfileEventsCumulative.";
|
||||||
static inline constexpr auto current_metrics_path_prefix = "ClickHouse.Metrics.";
|
static constexpr auto current_metrics_path_prefix = "ClickHouse.Metrics.";
|
||||||
static inline constexpr auto asynchronous_metrics_path_prefix = "ClickHouse.AsynchronousMetrics.";
|
static constexpr auto asynchronous_metrics_path_prefix = "ClickHouse.AsynchronousMetrics.";
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -341,7 +341,7 @@ public:
|
|||||||
value[i] = Node::read(buf, arena);
|
value[i] = Node::read(buf, arena);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::optional<size_t> getBaseIndex(Data & data) const
|
std::optional<size_t> getBaseIndex(Data & data) const
|
||||||
{
|
{
|
||||||
if (data.value.size() == 0)
|
if (data.value.size() == 0)
|
||||||
return {};
|
return {};
|
||||||
|
@ -73,7 +73,7 @@ private:
|
|||||||
using Base = AggregateFunctionNullBase<result_is_nullable, serialize_flag,
|
using Base = AggregateFunctionNullBase<result_is_nullable, serialize_flag,
|
||||||
AggregateFunctionIfNullUnary<result_is_nullable, serialize_flag>>;
|
AggregateFunctionIfNullUnary<result_is_nullable, serialize_flag>>;
|
||||||
|
|
||||||
inline bool singleFilter(const IColumn ** columns, size_t row_num) const
|
bool singleFilter(const IColumn ** columns, size_t row_num) const
|
||||||
{
|
{
|
||||||
const IColumn * filter_column = columns[num_arguments - 1];
|
const IColumn * filter_column = columns[num_arguments - 1];
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ public:
|
|||||||
filter_is_only_null = arguments.back()->onlyNull();
|
filter_is_only_null = arguments.back()->onlyNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool singleFilter(const IColumn ** columns, size_t row_num, size_t num_arguments)
|
static bool singleFilter(const IColumn ** columns, size_t row_num, size_t num_arguments)
|
||||||
{
|
{
|
||||||
return assert_cast<const ColumnUInt8 &>(*columns[num_arguments - 1]).getData()[row_num];
|
return assert_cast<const ColumnUInt8 &>(*columns[num_arguments - 1]).getData()[row_num];
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ class QuantileTDigest
|
|||||||
compress();
|
compress();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool canBeMerged(const BetterFloat & l_mean, const Value & r_mean)
|
bool canBeMerged(const BetterFloat & l_mean, const Value & r_mean)
|
||||||
{
|
{
|
||||||
return l_mean == r_mean || (!std::isinf(l_mean) && !std::isinf(r_mean));
|
return l_mean == r_mean || (!std::isinf(l_mean) && !std::isinf(r_mean));
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ namespace detail
|
|||||||
UInt64 count_big[BIG_SIZE];
|
UInt64 count_big[BIG_SIZE];
|
||||||
|
|
||||||
/// Get value of quantile by index in array `count_big`.
|
/// Get value of quantile by index in array `count_big`.
|
||||||
static inline UInt16 indexInBigToValue(size_t i)
|
static UInt16 indexInBigToValue(size_t i)
|
||||||
{
|
{
|
||||||
return (i * BIG_PRECISION) + SMALL_THRESHOLD
|
return (i * BIG_PRECISION) + SMALL_THRESHOLD
|
||||||
+ (intHash32<0>(i) % BIG_PRECISION - (BIG_PRECISION / 2)); /// A small randomization so that it is not noticeable that all the values are even.
|
+ (intHash32<0>(i) % BIG_PRECISION - (BIG_PRECISION / 2)); /// A small randomization so that it is not noticeable that all the values are even.
|
||||||
|
@ -24,14 +24,14 @@ private:
|
|||||||
std::unique_ptr<datasketches::update_theta_sketch> sk_update;
|
std::unique_ptr<datasketches::update_theta_sketch> sk_update;
|
||||||
std::unique_ptr<datasketches::theta_union> sk_union;
|
std::unique_ptr<datasketches::theta_union> sk_union;
|
||||||
|
|
||||||
inline datasketches::update_theta_sketch * getSkUpdate()
|
datasketches::update_theta_sketch * getSkUpdate()
|
||||||
{
|
{
|
||||||
if (!sk_update)
|
if (!sk_update)
|
||||||
sk_update = std::make_unique<datasketches::update_theta_sketch>(datasketches::update_theta_sketch::builder().build());
|
sk_update = std::make_unique<datasketches::update_theta_sketch>(datasketches::update_theta_sketch::builder().build());
|
||||||
return sk_update.get();
|
return sk_update.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline datasketches::theta_union * getSkUnion()
|
datasketches::theta_union * getSkUnion()
|
||||||
{
|
{
|
||||||
if (!sk_union)
|
if (!sk_union)
|
||||||
sk_union = std::make_unique<datasketches::theta_union>(datasketches::theta_union::builder().build());
|
sk_union = std::make_unique<datasketches::theta_union>(datasketches::theta_union::builder().build());
|
||||||
|
@ -38,7 +38,7 @@ bool isAllArgumentsContiguousInMemory(const DataTypes & argument_types);
|
|||||||
template <>
|
template <>
|
||||||
struct UniqVariadicHash<false, false>
|
struct UniqVariadicHash<false, false>
|
||||||
{
|
{
|
||||||
static inline UInt64 apply(size_t num_args, const IColumn ** columns, size_t row_num)
|
static UInt64 apply(size_t num_args, const IColumn ** columns, size_t row_num)
|
||||||
{
|
{
|
||||||
UInt64 hash;
|
UInt64 hash;
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ struct UniqVariadicHash<false, false>
|
|||||||
template <>
|
template <>
|
||||||
struct UniqVariadicHash<false, true>
|
struct UniqVariadicHash<false, true>
|
||||||
{
|
{
|
||||||
static inline UInt64 apply(size_t num_args, const IColumn ** columns, size_t row_num)
|
static UInt64 apply(size_t num_args, const IColumn ** columns, size_t row_num)
|
||||||
{
|
{
|
||||||
UInt64 hash;
|
UInt64 hash;
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ struct UniqVariadicHash<false, true>
|
|||||||
template <>
|
template <>
|
||||||
struct UniqVariadicHash<true, false>
|
struct UniqVariadicHash<true, false>
|
||||||
{
|
{
|
||||||
static inline UInt128 apply(size_t num_args, const IColumn ** columns, size_t row_num)
|
static UInt128 apply(size_t num_args, const IColumn ** columns, size_t row_num)
|
||||||
{
|
{
|
||||||
const IColumn ** column = columns;
|
const IColumn ** column = columns;
|
||||||
const IColumn ** columns_end = column + num_args;
|
const IColumn ** columns_end = column + num_args;
|
||||||
@ -114,7 +114,7 @@ struct UniqVariadicHash<true, false>
|
|||||||
template <>
|
template <>
|
||||||
struct UniqVariadicHash<true, true>
|
struct UniqVariadicHash<true, true>
|
||||||
{
|
{
|
||||||
static inline UInt128 apply(size_t num_args, const IColumn ** columns, size_t row_num)
|
static UInt128 apply(size_t num_args, const IColumn ** columns, size_t row_num)
|
||||||
{
|
{
|
||||||
const auto & tuple_columns = assert_cast<const ColumnTuple *>(columns[0])->getColumns();
|
const auto & tuple_columns = assert_cast<const ColumnTuple *>(columns[0])->getColumns();
|
||||||
|
|
||||||
|
@ -105,14 +105,14 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t buf_size() const { return 1ULL << size_degree; } /// NOLINT
|
size_t buf_size() const { return 1ULL << size_degree; } /// NOLINT
|
||||||
inline size_t max_fill() const { return 1ULL << (size_degree - 1); } /// NOLINT
|
size_t max_fill() const { return 1ULL << (size_degree - 1); } /// NOLINT
|
||||||
inline size_t mask() const { return buf_size() - 1; }
|
size_t mask() const { return buf_size() - 1; }
|
||||||
|
|
||||||
inline size_t place(HashValue x) const { return (x >> UNIQUES_HASH_BITS_FOR_SKIP) & mask(); }
|
size_t place(HashValue x) const { return (x >> UNIQUES_HASH_BITS_FOR_SKIP) & mask(); }
|
||||||
|
|
||||||
/// The value is divided by 2 ^ skip_degree
|
/// The value is divided by 2 ^ skip_degree
|
||||||
inline bool good(HashValue hash) const { return hash == ((hash >> skip_degree) << skip_degree); }
|
bool good(HashValue hash) const { return hash == ((hash >> skip_degree) << skip_degree); }
|
||||||
|
|
||||||
HashValue hash(Value key) const { return static_cast<HashValue>(Hash()(key)); }
|
HashValue hash(Value key) const { return static_cast<HashValue>(Hash()(key)); }
|
||||||
|
|
||||||
|
@ -173,13 +173,13 @@ private:
|
|||||||
return arithmetic_function_clone;
|
return arithmetic_function_clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void resolveOrdinaryFunctionNode(FunctionNode & function_node, const String & function_name) const
|
void resolveOrdinaryFunctionNode(FunctionNode & function_node, const String & function_name) const
|
||||||
{
|
{
|
||||||
auto function = FunctionFactory::instance().get(function_name, getContext());
|
auto function = FunctionFactory::instance().get(function_name, getContext());
|
||||||
function_node.resolveAsFunction(function->build(function_node.getArgumentColumns()));
|
function_node.resolveAsFunction(function->build(function_node.getArgumentColumns()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void resolveAggregateFunctionNode(FunctionNode & function_node, const QueryTreeNodePtr & argument, const String & aggregate_function_name)
|
static void resolveAggregateFunctionNode(FunctionNode & function_node, const QueryTreeNodePtr & argument, const String & aggregate_function_name)
|
||||||
{
|
{
|
||||||
auto function_aggregate_function = function_node.getAggregateFunction();
|
auto function_aggregate_function = function_node.getAggregateFunction();
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ private:
|
|||||||
return result_function;
|
return result_function;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QueryTreeNodePtr makeEqualsFunction(QueryTreeNodePtr lhs_argument, QueryTreeNodePtr rhs_argument) const
|
QueryTreeNodePtr makeEqualsFunction(QueryTreeNodePtr lhs_argument, QueryTreeNodePtr rhs_argument) const
|
||||||
{
|
{
|
||||||
return makeComparisonFunction(std::move(lhs_argument), std::move(rhs_argument), "equals");
|
return makeComparisonFunction(std::move(lhs_argument), std::move(rhs_argument), "equals");
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
inline void resolveOrdinaryFunctionNode(FunctionNode & function_node, const String & function_name) const
|
void resolveOrdinaryFunctionNode(FunctionNode & function_node, const String & function_name) const
|
||||||
{
|
{
|
||||||
auto function = FunctionFactory::instance().get(function_name, getContext());
|
auto function = FunctionFactory::instance().get(function_name, getContext());
|
||||||
function_node.resolveAsFunction(function->build(function_node.getArgumentColumns()));
|
function_node.resolveAsFunction(function->build(function_node.getArgumentColumns()));
|
||||||
|
@ -59,7 +59,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
static inline void resolveAsCountAggregateFunction(FunctionNode & function_node)
|
static void resolveAsCountAggregateFunction(FunctionNode & function_node)
|
||||||
{
|
{
|
||||||
AggregateFunctionProperties properties;
|
AggregateFunctionProperties properties;
|
||||||
auto aggregate_function = AggregateFunctionFactory::instance().get("count", NullsAction::EMPTY, {}, {}, properties);
|
auto aggregate_function = AggregateFunctionFactory::instance().get("count", NullsAction::EMPTY, {}, {}, properties);
|
||||||
|
@ -108,7 +108,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static inline void resolveAsAggregateFunctionWithIf(FunctionNode & function_node, const DataTypes & argument_types)
|
static void resolveAsAggregateFunctionWithIf(FunctionNode & function_node, const DataTypes & argument_types)
|
||||||
{
|
{
|
||||||
auto result_type = function_node.getResultType();
|
auto result_type = function_node.getResultType();
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ private:
|
|||||||
function_node.resolveAsFunction(function->build(function_node.getArgumentColumns()));
|
function_node.resolveAsFunction(function->build(function_node.getArgumentColumns()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void resolveAsAggregateFunctionNode(FunctionNode & function_node, const DataTypePtr & argument_type)
|
static void resolveAsAggregateFunctionNode(FunctionNode & function_node, const DataTypePtr & argument_type)
|
||||||
{
|
{
|
||||||
AggregateFunctionProperties properties;
|
AggregateFunctionProperties properties;
|
||||||
const auto aggregate_function = AggregateFunctionFactory::instance().get(function_node.getFunctionName(),
|
const auto aggregate_function = AggregateFunctionFactory::instance().get(function_node.getFunctionName(),
|
||||||
|
@ -156,7 +156,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static inline void resolveAsCountIfAggregateFunction(FunctionNode & function_node, const DataTypePtr & argument_type)
|
static void resolveAsCountIfAggregateFunction(FunctionNode & function_node, const DataTypePtr & argument_type)
|
||||||
{
|
{
|
||||||
AggregateFunctionProperties properties;
|
AggregateFunctionProperties properties;
|
||||||
auto aggregate_function = AggregateFunctionFactory::instance().get(
|
auto aggregate_function = AggregateFunctionFactory::instance().get(
|
||||||
@ -165,7 +165,7 @@ private:
|
|||||||
function_node.resolveAsAggregateFunction(std::move(aggregate_function));
|
function_node.resolveAsAggregateFunction(std::move(aggregate_function));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QueryTreeNodePtr getMultiplyFunction(QueryTreeNodePtr left, QueryTreeNodePtr right)
|
QueryTreeNodePtr getMultiplyFunction(QueryTreeNodePtr left, QueryTreeNodePtr right)
|
||||||
{
|
{
|
||||||
auto multiply_function_node = std::make_shared<FunctionNode>("multiply");
|
auto multiply_function_node = std::make_shared<FunctionNode>("multiply");
|
||||||
auto & multiply_arguments_nodes = multiply_function_node->getArguments().getNodes();
|
auto & multiply_arguments_nodes = multiply_function_node->getArguments().getNodes();
|
||||||
|
@ -14,8 +14,8 @@ namespace DB
|
|||||||
class CatBoostLibraryBridgeHelper final : public LibraryBridgeHelper
|
class CatBoostLibraryBridgeHelper final : public LibraryBridgeHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static constexpr inline auto PING_HANDLER = "/catboost_ping";
|
static constexpr auto PING_HANDLER = "/catboost_ping";
|
||||||
static constexpr inline auto MAIN_HANDLER = "/catboost_request";
|
static constexpr auto MAIN_HANDLER = "/catboost_request";
|
||||||
|
|
||||||
explicit CatBoostLibraryBridgeHelper(
|
explicit CatBoostLibraryBridgeHelper(
|
||||||
ContextPtr context_,
|
ContextPtr context_,
|
||||||
@ -38,11 +38,11 @@ protected:
|
|||||||
bool bridgeHandShake() override;
|
bool bridgeHandShake() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr inline auto CATBOOST_LIST_METHOD = "catboost_list";
|
static constexpr auto CATBOOST_LIST_METHOD = "catboost_list";
|
||||||
static constexpr inline auto CATBOOST_REMOVEMODEL_METHOD = "catboost_removeModel";
|
static constexpr auto CATBOOST_REMOVEMODEL_METHOD = "catboost_removeModel";
|
||||||
static constexpr inline auto CATBOOST_REMOVEALLMODELS_METHOD = "catboost_removeAllModels";
|
static constexpr auto CATBOOST_REMOVEALLMODELS_METHOD = "catboost_removeAllModels";
|
||||||
static constexpr inline auto CATBOOST_GETTREECOUNT_METHOD = "catboost_GetTreeCount";
|
static constexpr auto CATBOOST_GETTREECOUNT_METHOD = "catboost_GetTreeCount";
|
||||||
static constexpr inline auto CATBOOST_LIB_EVALUATE_METHOD = "catboost_libEvaluate";
|
static constexpr auto CATBOOST_LIB_EVALUATE_METHOD = "catboost_libEvaluate";
|
||||||
|
|
||||||
Poco::URI createRequestURI(const String & method) const;
|
Poco::URI createRequestURI(const String & method) const;
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ public:
|
|||||||
String dict_attributes;
|
String dict_attributes;
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr inline auto PING_HANDLER = "/extdict_ping";
|
static constexpr auto PING_HANDLER = "/extdict_ping";
|
||||||
static constexpr inline auto MAIN_HANDLER = "/extdict_request";
|
static constexpr auto MAIN_HANDLER = "/extdict_request";
|
||||||
|
|
||||||
ExternalDictionaryLibraryBridgeHelper(ContextPtr context_, const Block & sample_block, const Field & dictionary_id_, const LibraryInitData & library_data_);
|
ExternalDictionaryLibraryBridgeHelper(ContextPtr context_, const Block & sample_block, const Field & dictionary_id_, const LibraryInitData & library_data_);
|
||||||
|
|
||||||
@ -62,14 +62,14 @@ protected:
|
|||||||
ReadWriteBufferFromHTTP::OutStreamCallback getInitLibraryCallback() const;
|
ReadWriteBufferFromHTTP::OutStreamCallback getInitLibraryCallback() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr inline auto EXT_DICT_LIB_NEW_METHOD = "extDict_libNew";
|
static constexpr auto EXT_DICT_LIB_NEW_METHOD = "extDict_libNew";
|
||||||
static constexpr inline auto EXT_DICT_LIB_CLONE_METHOD = "extDict_libClone";
|
static constexpr auto EXT_DICT_LIB_CLONE_METHOD = "extDict_libClone";
|
||||||
static constexpr inline auto EXT_DICT_LIB_DELETE_METHOD = "extDict_libDelete";
|
static constexpr auto EXT_DICT_LIB_DELETE_METHOD = "extDict_libDelete";
|
||||||
static constexpr inline auto EXT_DICT_LOAD_ALL_METHOD = "extDict_loadAll";
|
static constexpr auto EXT_DICT_LOAD_ALL_METHOD = "extDict_loadAll";
|
||||||
static constexpr inline auto EXT_DICT_LOAD_IDS_METHOD = "extDict_loadIds";
|
static constexpr auto EXT_DICT_LOAD_IDS_METHOD = "extDict_loadIds";
|
||||||
static constexpr inline auto EXT_DICT_LOAD_KEYS_METHOD = "extDict_loadKeys";
|
static constexpr auto EXT_DICT_LOAD_KEYS_METHOD = "extDict_loadKeys";
|
||||||
static constexpr inline auto EXT_DICT_IS_MODIFIED_METHOD = "extDict_isModified";
|
static constexpr auto EXT_DICT_IS_MODIFIED_METHOD = "extDict_isModified";
|
||||||
static constexpr inline auto EXT_DICT_SUPPORTS_SELECTIVE_LOAD_METHOD = "extDict_supportsSelectiveLoad";
|
static constexpr auto EXT_DICT_SUPPORTS_SELECTIVE_LOAD_METHOD = "extDict_supportsSelectiveLoad";
|
||||||
|
|
||||||
Poco::URI createRequestURI(const String & method) const;
|
Poco::URI createRequestURI(const String & method) const;
|
||||||
|
|
||||||
|
@ -16,9 +16,9 @@ class IBridgeHelper: protected WithContext
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr inline auto DEFAULT_HOST = "127.0.0.1";
|
static constexpr auto DEFAULT_HOST = "127.0.0.1";
|
||||||
static constexpr inline auto DEFAULT_FORMAT = "RowBinary";
|
static constexpr auto DEFAULT_FORMAT = "RowBinary";
|
||||||
static constexpr inline auto PING_OK_ANSWER = "Ok.";
|
static constexpr auto PING_OK_ANSWER = "Ok.";
|
||||||
|
|
||||||
static const inline std::string PING_METHOD = Poco::Net::HTTPRequest::HTTP_GET;
|
static const inline std::string PING_METHOD = Poco::Net::HTTPRequest::HTTP_GET;
|
||||||
static const inline std::string MAIN_METHOD = Poco::Net::HTTPRequest::HTTP_POST;
|
static const inline std::string MAIN_METHOD = Poco::Net::HTTPRequest::HTTP_POST;
|
||||||
|
@ -37,7 +37,7 @@ protected:
|
|||||||
|
|
||||||
Poco::URI createBaseURI() const override;
|
Poco::URI createBaseURI() const override;
|
||||||
|
|
||||||
static constexpr inline size_t DEFAULT_PORT = 9012;
|
static constexpr size_t DEFAULT_PORT = 9012;
|
||||||
|
|
||||||
const Poco::Util::AbstractConfiguration & config;
|
const Poco::Util::AbstractConfiguration & config;
|
||||||
LoggerPtr log;
|
LoggerPtr log;
|
||||||
|
@ -52,12 +52,12 @@ class XDBCBridgeHelper : public IXDBCBridgeHelper
|
|||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static constexpr inline auto DEFAULT_PORT = BridgeHelperMixin::DEFAULT_PORT;
|
static constexpr auto DEFAULT_PORT = BridgeHelperMixin::DEFAULT_PORT;
|
||||||
static constexpr inline auto PING_HANDLER = "/ping";
|
static constexpr auto PING_HANDLER = "/ping";
|
||||||
static constexpr inline auto MAIN_HANDLER = "/";
|
static constexpr auto MAIN_HANDLER = "/";
|
||||||
static constexpr inline auto COL_INFO_HANDLER = "/columns_info";
|
static constexpr auto COL_INFO_HANDLER = "/columns_info";
|
||||||
static constexpr inline auto IDENTIFIER_QUOTE_HANDLER = "/identifier_quote";
|
static constexpr auto IDENTIFIER_QUOTE_HANDLER = "/identifier_quote";
|
||||||
static constexpr inline auto SCHEMA_ALLOWED_HANDLER = "/schema_allowed";
|
static constexpr auto SCHEMA_ALLOWED_HANDLER = "/schema_allowed";
|
||||||
|
|
||||||
XDBCBridgeHelper(
|
XDBCBridgeHelper(
|
||||||
ContextPtr context_,
|
ContextPtr context_,
|
||||||
@ -256,7 +256,7 @@ protected:
|
|||||||
|
|
||||||
struct JDBCBridgeMixin
|
struct JDBCBridgeMixin
|
||||||
{
|
{
|
||||||
static constexpr inline auto DEFAULT_PORT = 9019;
|
static constexpr auto DEFAULT_PORT = 9019;
|
||||||
|
|
||||||
static String configPrefix()
|
static String configPrefix()
|
||||||
{
|
{
|
||||||
@ -287,7 +287,7 @@ struct JDBCBridgeMixin
|
|||||||
|
|
||||||
struct ODBCBridgeMixin
|
struct ODBCBridgeMixin
|
||||||
{
|
{
|
||||||
static constexpr inline auto DEFAULT_PORT = 9018;
|
static constexpr auto DEFAULT_PORT = 9018;
|
||||||
|
|
||||||
static String configPrefix()
|
static String configPrefix()
|
||||||
{
|
{
|
||||||
|
@ -69,9 +69,9 @@ union CPUInfo
|
|||||||
UInt32 edx;
|
UInt32 edx;
|
||||||
} registers;
|
} registers;
|
||||||
|
|
||||||
inline explicit CPUInfo(UInt32 op) noexcept { cpuid(op, info); }
|
explicit CPUInfo(UInt32 op) noexcept { cpuid(op, info); }
|
||||||
|
|
||||||
inline CPUInfo(UInt32 op, UInt32 sub_op) noexcept { cpuid(op, sub_op, info); }
|
CPUInfo(UInt32 op, UInt32 sub_op) noexcept { cpuid(op, sub_op, info); }
|
||||||
};
|
};
|
||||||
|
|
||||||
inline bool haveRDTSCP() noexcept
|
inline bool haveRDTSCP() noexcept
|
||||||
|
@ -453,7 +453,7 @@ protected:
|
|||||||
/// Return the columns which actually contain the values of the keys.
|
/// Return the columns which actually contain the values of the keys.
|
||||||
/// For a given key column, if it is nullable, we return its nested
|
/// For a given key column, if it is nullable, we return its nested
|
||||||
/// column. Otherwise we return the key column itself.
|
/// column. Otherwise we return the key column itself.
|
||||||
inline const ColumnRawPtrs & getActualColumns() const
|
const ColumnRawPtrs & getActualColumns() const
|
||||||
{
|
{
|
||||||
return actual_columns;
|
return actual_columns;
|
||||||
}
|
}
|
||||||
|
@ -292,13 +292,13 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline T & getContainer()
|
T & getContainer()
|
||||||
{
|
{
|
||||||
return *reinterpret_cast<T *>(address & mask);
|
return *reinterpret_cast<T *>(address & mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline const T & getContainer() const
|
const T & getContainer() const
|
||||||
{
|
{
|
||||||
return *reinterpret_cast<T *>(address & mask);
|
return *reinterpret_cast<T *>(address & mask);
|
||||||
}
|
}
|
||||||
@ -309,7 +309,7 @@ private:
|
|||||||
address |= static_cast<UInt8>(t);
|
address |= static_cast<UInt8>(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline details::ContainerType getContainerType() const
|
details::ContainerType getContainerType() const
|
||||||
{
|
{
|
||||||
return static_cast<details::ContainerType>(address & ~mask);
|
return static_cast<details::ContainerType>(address & ~mask);
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ public:
|
|||||||
|
|
||||||
/** Return the current cell number and the corresponding content.
|
/** Return the current cell number and the corresponding content.
|
||||||
*/
|
*/
|
||||||
inline std::pair<BucketIndex, UInt8> get() const
|
std::pair<BucketIndex, UInt8> get() const
|
||||||
{
|
{
|
||||||
if ((current_bucket_index == 0) || is_eof)
|
if ((current_bucket_index == 0) || is_eof)
|
||||||
throw Exception(ErrorCodes::NO_AVAILABLE_DATA, "No available data.");
|
throw Exception(ErrorCodes::NO_AVAILABLE_DATA, "No available data.");
|
||||||
|
@ -37,7 +37,7 @@ namespace fs = std::filesystem;
|
|||||||
class CounterInFile
|
class CounterInFile
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static inline constexpr size_t SMALL_READ_WRITE_BUFFER_SIZE = 16;
|
static constexpr size_t SMALL_READ_WRITE_BUFFER_SIZE = 16;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// path - the name of the file, including the path
|
/// path - the name of the file, including the path
|
||||||
|
@ -62,9 +62,9 @@ public:
|
|||||||
static void updatePerformanceCountersIfNeeded();
|
static void updatePerformanceCountersIfNeeded();
|
||||||
|
|
||||||
static ProfileEvents::Counters & getProfileEvents();
|
static ProfileEvents::Counters & getProfileEvents();
|
||||||
inline ALWAYS_INLINE static MemoryTracker * getMemoryTracker()
|
static MemoryTracker * getMemoryTracker()
|
||||||
{
|
{
|
||||||
if (unlikely(!current_thread))
|
if (!current_thread) [[unlikely]]
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return ¤t_thread->memory_tracker;
|
return ¤t_thread->memory_tracker;
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const value_type & get() const
|
const value_type & get() const
|
||||||
{
|
{
|
||||||
if (!is_initialized || is_eof)
|
if (!is_initialized || is_eof)
|
||||||
throw DB::Exception(DB::ErrorCodes::NO_AVAILABLE_DATA, "No available data");
|
throw DB::Exception(DB::ErrorCodes::NO_AVAILABLE_DATA, "No available data");
|
||||||
|
@ -844,7 +844,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const value_type & get() const
|
const value_type & get() const
|
||||||
{
|
{
|
||||||
if (!is_initialized || is_eof)
|
if (!is_initialized || is_eof)
|
||||||
throw DB::Exception(DB::ErrorCodes::NO_AVAILABLE_DATA, "No available data");
|
throw DB::Exception(DB::ErrorCodes::NO_AVAILABLE_DATA, "No available data");
|
||||||
|
@ -69,7 +69,7 @@ struct PackedHashMapCell : public HashMapCell<Key, TMapped, Hash, TState, Packed
|
|||||||
bool isZero(const State & state) const { return isZero(this->value.first, state); }
|
bool isZero(const State & state) const { return isZero(this->value.first, state); }
|
||||||
static bool isZero(const Key key, const State & /*state*/) { return ZeroTraits::check(key); }
|
static bool isZero(const Key key, const State & /*state*/) { return ZeroTraits::check(key); }
|
||||||
|
|
||||||
static inline bool bitEqualsByValue(key_type a, key_type b) { return a == b; }
|
static bool bitEqualsByValue(key_type a, key_type b) { return a == b; }
|
||||||
|
|
||||||
template <size_t I>
|
template <size_t I>
|
||||||
auto get() const
|
auto get() const
|
||||||
|
@ -112,7 +112,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const value_type & get() const
|
const value_type & get() const
|
||||||
{
|
{
|
||||||
if (!is_initialized || is_eof)
|
if (!is_initialized || is_eof)
|
||||||
throw DB::Exception(DB::ErrorCodes::NO_AVAILABLE_DATA, "No available data");
|
throw DB::Exception(DB::ErrorCodes::NO_AVAILABLE_DATA, "No available data");
|
||||||
|
@ -128,13 +128,13 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void update(UInt8 cur_rank, UInt8 new_rank)
|
void update(UInt8 cur_rank, UInt8 new_rank)
|
||||||
{
|
{
|
||||||
denominator -= static_cast<T>(1.0) / (1ULL << cur_rank);
|
denominator -= static_cast<T>(1.0) / (1ULL << cur_rank);
|
||||||
denominator += static_cast<T>(1.0) / (1ULL << new_rank);
|
denominator += static_cast<T>(1.0) / (1ULL << new_rank);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void update(UInt8 rank)
|
void update(UInt8 rank)
|
||||||
{
|
{
|
||||||
denominator += static_cast<T>(1.0) / (1ULL << rank);
|
denominator += static_cast<T>(1.0) / (1ULL << rank);
|
||||||
}
|
}
|
||||||
@ -166,13 +166,13 @@ public:
|
|||||||
rank_count[0] = static_cast<UInt32>(initial_value);
|
rank_count[0] = static_cast<UInt32>(initial_value);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void update(UInt8 cur_rank, UInt8 new_rank)
|
void update(UInt8 cur_rank, UInt8 new_rank)
|
||||||
{
|
{
|
||||||
--rank_count[cur_rank];
|
--rank_count[cur_rank];
|
||||||
++rank_count[new_rank];
|
++rank_count[new_rank];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void update(UInt8 rank)
|
void update(UInt8 rank)
|
||||||
{
|
{
|
||||||
++rank_count[rank];
|
++rank_count[rank];
|
||||||
}
|
}
|
||||||
@ -429,13 +429,13 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
/// Extract subset of bits in [begin, end[ range.
|
/// Extract subset of bits in [begin, end[ range.
|
||||||
inline HashValueType extractBitSequence(HashValueType val, UInt8 begin, UInt8 end) const
|
HashValueType extractBitSequence(HashValueType val, UInt8 begin, UInt8 end) const
|
||||||
{
|
{
|
||||||
return (val >> begin) & ((1ULL << (end - begin)) - 1);
|
return (val >> begin) & ((1ULL << (end - begin)) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Rank is number of trailing zeros.
|
/// Rank is number of trailing zeros.
|
||||||
inline UInt8 calculateRank(HashValueType val) const
|
UInt8 calculateRank(HashValueType val) const
|
||||||
{
|
{
|
||||||
if (unlikely(val == 0))
|
if (unlikely(val == 0))
|
||||||
return max_rank;
|
return max_rank;
|
||||||
@ -448,7 +448,7 @@ private:
|
|||||||
return zeros_plus_one;
|
return zeros_plus_one;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline HashValueType getHash(Value key) const
|
HashValueType getHash(Value key) const
|
||||||
{
|
{
|
||||||
/// NOTE: this should be OK, since value is the same as key for HLL.
|
/// NOTE: this should be OK, since value is the same as key for HLL.
|
||||||
return static_cast<HashValueType>(
|
return static_cast<HashValueType>(
|
||||||
@ -496,7 +496,7 @@ private:
|
|||||||
throw Poco::Exception("Internal error", DB::ErrorCodes::LOGICAL_ERROR);
|
throw Poco::Exception("Internal error", DB::ErrorCodes::LOGICAL_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double applyCorrection(double raw_estimate) const
|
double applyCorrection(double raw_estimate) const
|
||||||
{
|
{
|
||||||
double fixed_estimate;
|
double fixed_estimate;
|
||||||
|
|
||||||
@ -525,7 +525,7 @@ private:
|
|||||||
/// Correction used in HyperLogLog++ algorithm.
|
/// Correction used in HyperLogLog++ algorithm.
|
||||||
/// Source: "HyperLogLog in Practice: Algorithmic Engineering of a State of The Art Cardinality Estimation Algorithm"
|
/// Source: "HyperLogLog in Practice: Algorithmic Engineering of a State of The Art Cardinality Estimation Algorithm"
|
||||||
/// (S. Heule et al., Proceedings of the EDBT 2013 Conference).
|
/// (S. Heule et al., Proceedings of the EDBT 2013 Conference).
|
||||||
inline double applyBiasCorrection(double raw_estimate) const
|
double applyBiasCorrection(double raw_estimate) const
|
||||||
{
|
{
|
||||||
double fixed_estimate;
|
double fixed_estimate;
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ private:
|
|||||||
/// Calculation of unique values using LinearCounting algorithm.
|
/// Calculation of unique values using LinearCounting algorithm.
|
||||||
/// Source: "A Linear-time Probabilistic Counting Algorithm for Database Applications"
|
/// Source: "A Linear-time Probabilistic Counting Algorithm for Database Applications"
|
||||||
/// (Whang et al., ACM Trans. Database Syst., pp. 208-229, 1990).
|
/// (Whang et al., ACM Trans. Database Syst., pp. 208-229, 1990).
|
||||||
inline double applyLinearCorrection(double raw_estimate) const
|
double applyLinearCorrection(double raw_estimate) const
|
||||||
{
|
{
|
||||||
double fixed_estimate;
|
double fixed_estimate;
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ struct Interval
|
|||||||
|
|
||||||
Interval(IntervalStorageType left_, IntervalStorageType right_) : left(left_), right(right_) { }
|
Interval(IntervalStorageType left_, IntervalStorageType right_) : left(left_), right(right_) { }
|
||||||
|
|
||||||
inline bool contains(IntervalStorageType point) const { return left <= point && point <= right; }
|
bool contains(IntervalStorageType point) const { return left <= point && point <= right; }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename IntervalStorageType>
|
template <typename IntervalStorageType>
|
||||||
@ -290,7 +290,7 @@ private:
|
|||||||
|
|
||||||
IntervalStorageType middle_element;
|
IntervalStorageType middle_element;
|
||||||
|
|
||||||
inline bool hasValue() const { return sorted_intervals_range_size != 0; }
|
bool hasValue() const { return sorted_intervals_range_size != 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
using IntervalWithEmptyValue = Interval;
|
using IntervalWithEmptyValue = Interval;
|
||||||
@ -585,7 +585,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t findFirstIteratorNodeIndex() const
|
size_t findFirstIteratorNodeIndex() const
|
||||||
{
|
{
|
||||||
size_t nodes_size = nodes.size();
|
size_t nodes_size = nodes.size();
|
||||||
size_t result_index = 0;
|
size_t result_index = 0;
|
||||||
@ -602,7 +602,7 @@ private:
|
|||||||
return result_index;
|
return result_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t findLastIteratorNodeIndex() const
|
size_t findLastIteratorNodeIndex() const
|
||||||
{
|
{
|
||||||
if (unlikely(nodes.empty()))
|
if (unlikely(nodes.empty()))
|
||||||
return 0;
|
return 0;
|
||||||
@ -618,7 +618,7 @@ private:
|
|||||||
return result_index;
|
return result_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void increaseIntervalsSize()
|
void increaseIntervalsSize()
|
||||||
{
|
{
|
||||||
/// Before tree is build we store all intervals size in our first node to allow tree iteration.
|
/// Before tree is build we store all intervals size in our first node to allow tree iteration.
|
||||||
++intervals_size;
|
++intervals_size;
|
||||||
@ -630,7 +630,7 @@ private:
|
|||||||
size_t intervals_size = 0;
|
size_t intervals_size = 0;
|
||||||
bool tree_is_built = false;
|
bool tree_is_built = false;
|
||||||
|
|
||||||
static inline const Interval & getInterval(const IntervalWithValue & interval_with_value)
|
static const Interval & getInterval(const IntervalWithValue & interval_with_value)
|
||||||
{
|
{
|
||||||
if constexpr (is_empty_value)
|
if constexpr (is_empty_value)
|
||||||
return interval_with_value;
|
return interval_with_value;
|
||||||
@ -639,7 +639,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename IntervalCallback>
|
template <typename IntervalCallback>
|
||||||
static inline bool callCallback(const IntervalWithValue & interval, IntervalCallback && callback)
|
static bool callCallback(const IntervalWithValue & interval, IntervalCallback && callback)
|
||||||
{
|
{
|
||||||
if constexpr (is_empty_value)
|
if constexpr (is_empty_value)
|
||||||
return callback(interval);
|
return callback(interval);
|
||||||
@ -647,7 +647,7 @@ private:
|
|||||||
return callback(interval.first, interval.second);
|
return callback(interval.first, interval.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static void
|
||||||
intervalsToPoints(const std::vector<IntervalWithValue> & intervals, std::vector<IntervalStorageType> & temporary_points_storage)
|
intervalsToPoints(const std::vector<IntervalWithValue> & intervals, std::vector<IntervalStorageType> & temporary_points_storage)
|
||||||
{
|
{
|
||||||
for (const auto & interval_with_value : intervals)
|
for (const auto & interval_with_value : intervals)
|
||||||
@ -658,7 +658,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline IntervalStorageType pointsMedian(std::vector<IntervalStorageType> & points)
|
static IntervalStorageType pointsMedian(std::vector<IntervalStorageType> & points)
|
||||||
{
|
{
|
||||||
size_t size = points.size();
|
size_t size = points.size();
|
||||||
size_t middle_element_index = size / 2;
|
size_t middle_element_index = size / 2;
|
||||||
|
@ -26,62 +26,62 @@ class SimdJSONBasicFormatter
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit SimdJSONBasicFormatter(PaddedPODArray<UInt8> & buffer_) : buffer(buffer_) {}
|
explicit SimdJSONBasicFormatter(PaddedPODArray<UInt8> & buffer_) : buffer(buffer_) {}
|
||||||
inline void comma() { oneChar(','); }
|
void comma() { oneChar(','); }
|
||||||
/** Start an array, prints [ **/
|
/** Start an array, prints [ **/
|
||||||
inline void startArray() { oneChar('['); }
|
void startArray() { oneChar('['); }
|
||||||
/** End an array, prints ] **/
|
/** End an array, prints ] **/
|
||||||
inline void endArray() { oneChar(']'); }
|
void endArray() { oneChar(']'); }
|
||||||
/** Start an array, prints { **/
|
/** Start an array, prints { **/
|
||||||
inline void startObject() { oneChar('{'); }
|
void startObject() { oneChar('{'); }
|
||||||
/** Start an array, prints } **/
|
/** Start an array, prints } **/
|
||||||
inline void endObject() { oneChar('}'); }
|
void endObject() { oneChar('}'); }
|
||||||
/** Prints a true **/
|
/** Prints a true **/
|
||||||
inline void trueAtom()
|
void trueAtom()
|
||||||
{
|
{
|
||||||
const char * s = "true";
|
const char * s = "true";
|
||||||
buffer.insert(s, s + 4);
|
buffer.insert(s, s + 4);
|
||||||
}
|
}
|
||||||
/** Prints a false **/
|
/** Prints a false **/
|
||||||
inline void falseAtom()
|
void falseAtom()
|
||||||
{
|
{
|
||||||
const char * s = "false";
|
const char * s = "false";
|
||||||
buffer.insert(s, s + 5);
|
buffer.insert(s, s + 5);
|
||||||
}
|
}
|
||||||
/** Prints a null **/
|
/** Prints a null **/
|
||||||
inline void nullAtom()
|
void nullAtom()
|
||||||
{
|
{
|
||||||
const char * s = "null";
|
const char * s = "null";
|
||||||
buffer.insert(s, s + 4);
|
buffer.insert(s, s + 4);
|
||||||
}
|
}
|
||||||
/** Prints a number **/
|
/** Prints a number **/
|
||||||
inline void number(int64_t x)
|
void number(int64_t x)
|
||||||
{
|
{
|
||||||
char number_buffer[24];
|
char number_buffer[24];
|
||||||
auto res = std::to_chars(number_buffer, number_buffer + sizeof(number_buffer), x);
|
auto res = std::to_chars(number_buffer, number_buffer + sizeof(number_buffer), x);
|
||||||
buffer.insert(number_buffer, res.ptr);
|
buffer.insert(number_buffer, res.ptr);
|
||||||
}
|
}
|
||||||
/** Prints a number **/
|
/** Prints a number **/
|
||||||
inline void number(uint64_t x)
|
void number(uint64_t x)
|
||||||
{
|
{
|
||||||
char number_buffer[24];
|
char number_buffer[24];
|
||||||
auto res = std::to_chars(number_buffer, number_buffer + sizeof(number_buffer), x);
|
auto res = std::to_chars(number_buffer, number_buffer + sizeof(number_buffer), x);
|
||||||
buffer.insert(number_buffer, res.ptr);
|
buffer.insert(number_buffer, res.ptr);
|
||||||
}
|
}
|
||||||
/** Prints a number **/
|
/** Prints a number **/
|
||||||
inline void number(double x)
|
void number(double x)
|
||||||
{
|
{
|
||||||
char number_buffer[24];
|
char number_buffer[24];
|
||||||
auto res = std::to_chars(number_buffer, number_buffer + sizeof(number_buffer), x);
|
auto res = std::to_chars(number_buffer, number_buffer + sizeof(number_buffer), x);
|
||||||
buffer.insert(number_buffer, res.ptr);
|
buffer.insert(number_buffer, res.ptr);
|
||||||
}
|
}
|
||||||
/** Prints a key (string + colon) **/
|
/** Prints a key (string + colon) **/
|
||||||
inline void key(std::string_view unescaped)
|
void key(std::string_view unescaped)
|
||||||
{
|
{
|
||||||
string(unescaped);
|
string(unescaped);
|
||||||
oneChar(':');
|
oneChar(':');
|
||||||
}
|
}
|
||||||
/** Prints a string. The string is escaped as needed. **/
|
/** Prints a string. The string is escaped as needed. **/
|
||||||
inline void string(std::string_view unescaped)
|
void string(std::string_view unescaped)
|
||||||
{
|
{
|
||||||
oneChar('\"');
|
oneChar('\"');
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
@ -165,7 +165,7 @@ public:
|
|||||||
oneChar('\"');
|
oneChar('\"');
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void oneChar(char c)
|
void oneChar(char c)
|
||||||
{
|
{
|
||||||
buffer.push_back(c);
|
buffer.push_back(c);
|
||||||
}
|
}
|
||||||
@ -182,7 +182,7 @@ class SimdJSONElementFormatter
|
|||||||
public:
|
public:
|
||||||
explicit SimdJSONElementFormatter(PaddedPODArray<UInt8> & buffer_) : format(buffer_) {}
|
explicit SimdJSONElementFormatter(PaddedPODArray<UInt8> & buffer_) : format(buffer_) {}
|
||||||
/** Append an element to the builder (to be printed) **/
|
/** Append an element to the builder (to be printed) **/
|
||||||
inline void append(simdjson::dom::element value)
|
void append(simdjson::dom::element value)
|
||||||
{
|
{
|
||||||
switch (value.type())
|
switch (value.type())
|
||||||
{
|
{
|
||||||
@ -224,7 +224,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/** Append an array to the builder (to be printed) **/
|
/** Append an array to the builder (to be printed) **/
|
||||||
inline void append(simdjson::dom::array value)
|
void append(simdjson::dom::array value)
|
||||||
{
|
{
|
||||||
format.startArray();
|
format.startArray();
|
||||||
auto iter = value.begin();
|
auto iter = value.begin();
|
||||||
@ -241,7 +241,7 @@ public:
|
|||||||
format.endArray();
|
format.endArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void append(simdjson::dom::object value)
|
void append(simdjson::dom::object value)
|
||||||
{
|
{
|
||||||
format.startObject();
|
format.startObject();
|
||||||
auto pair = value.begin();
|
auto pair = value.begin();
|
||||||
@ -258,7 +258,7 @@ public:
|
|||||||
format.endObject();
|
format.endObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void append(simdjson::dom::key_value_pair kv)
|
void append(simdjson::dom::key_value_pair kv)
|
||||||
{
|
{
|
||||||
format.key(kv.key);
|
format.key(kv.key);
|
||||||
append(kv.value);
|
append(kv.value);
|
||||||
|
@ -284,7 +284,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename It1, typename It2>
|
template <typename It1, typename It2>
|
||||||
inline void assertNotIntersects(It1 from_begin [[maybe_unused]], It2 from_end [[maybe_unused]])
|
void assertNotIntersects(It1 from_begin [[maybe_unused]], It2 from_end [[maybe_unused]])
|
||||||
{
|
{
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
const char * ptr_begin = reinterpret_cast<const char *>(&*from_begin);
|
const char * ptr_begin = reinterpret_cast<const char *>(&*from_begin);
|
||||||
|
@ -174,7 +174,7 @@ public:
|
|||||||
items.emplace_back(std::make_shared<PooledObject>(allocObject(), *this));
|
items.emplace_back(std::make_shared<PooledObject>(allocObject(), *this));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t size()
|
size_t size()
|
||||||
{
|
{
|
||||||
std::lock_guard lock(mutex);
|
std::lock_guard lock(mutex);
|
||||||
return items.size();
|
return items.size();
|
||||||
|
@ -385,7 +385,7 @@ private:
|
|||||||
* PASS is counted from least significant (0), so the first pass is NUM_PASSES - 1.
|
* PASS is counted from least significant (0), so the first pass is NUM_PASSES - 1.
|
||||||
*/
|
*/
|
||||||
template <size_t PASS>
|
template <size_t PASS>
|
||||||
static inline void radixSortMSDInternal(Element * arr, size_t size, size_t limit)
|
static void radixSortMSDInternal(Element * arr, size_t size, size_t limit)
|
||||||
{
|
{
|
||||||
/// The beginning of every i-1-th bucket. 0th element will be equal to 1st.
|
/// The beginning of every i-1-th bucket. 0th element will be equal to 1st.
|
||||||
/// Last element will point to array end.
|
/// Last element will point to array end.
|
||||||
@ -528,7 +528,7 @@ private:
|
|||||||
|
|
||||||
// A helper to choose sorting algorithm based on array length
|
// A helper to choose sorting algorithm based on array length
|
||||||
template <size_t PASS>
|
template <size_t PASS>
|
||||||
static inline void radixSortMSDInternalHelper(Element * arr, size_t size, size_t limit)
|
static void radixSortMSDInternalHelper(Element * arr, size_t size, size_t limit)
|
||||||
{
|
{
|
||||||
if (size <= INSERTION_SORT_THRESHOLD)
|
if (size <= INSERTION_SORT_THRESHOLD)
|
||||||
insertionSortInternal(arr, size);
|
insertionSortInternal(arr, size);
|
||||||
|
@ -131,12 +131,12 @@ public:
|
|||||||
|
|
||||||
~SpaceSaving() { destroyElements(); }
|
~SpaceSaving() { destroyElements(); }
|
||||||
|
|
||||||
inline size_t size() const
|
size_t size() const
|
||||||
{
|
{
|
||||||
return counter_list.size();
|
return counter_list.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t capacity() const
|
size_t capacity() const
|
||||||
{
|
{
|
||||||
return m_capacity;
|
return m_capacity;
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ struct RUsageCounters
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static inline UInt64 getClockMonotonic()
|
static UInt64 getClockMonotonic()
|
||||||
{
|
{
|
||||||
struct timespec ts;
|
struct timespec ts;
|
||||||
if (0 != clock_gettime(CLOCK_MONOTONIC, &ts))
|
if (0 != clock_gettime(CLOCK_MONOTONIC, &ts))
|
||||||
|
@ -54,16 +54,16 @@ namespace VolnitskyTraits
|
|||||||
/// min haystack size to use main algorithm instead of fallback
|
/// min haystack size to use main algorithm instead of fallback
|
||||||
static constexpr size_t min_haystack_size_for_algorithm = 20000;
|
static constexpr size_t min_haystack_size_for_algorithm = 20000;
|
||||||
|
|
||||||
static inline bool isFallbackNeedle(const size_t needle_size, size_t haystack_size_hint = 0)
|
static bool isFallbackNeedle(const size_t needle_size, size_t haystack_size_hint = 0)
|
||||||
{
|
{
|
||||||
return needle_size < 2 * sizeof(Ngram) || needle_size >= std::numeric_limits<Offset>::max()
|
return needle_size < 2 * sizeof(Ngram) || needle_size >= std::numeric_limits<Offset>::max()
|
||||||
|| (haystack_size_hint && haystack_size_hint < min_haystack_size_for_algorithm);
|
|| (haystack_size_hint && haystack_size_hint < min_haystack_size_for_algorithm);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline Ngram toNGram(const UInt8 * const pos) { return unalignedLoad<Ngram>(pos); }
|
static Ngram toNGram(const UInt8 * const pos) { return unalignedLoad<Ngram>(pos); }
|
||||||
|
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
static inline bool putNGramASCIICaseInsensitive(const UInt8 * pos, int offset, Callback && putNGramBase)
|
static bool putNGramASCIICaseInsensitive(const UInt8 * pos, int offset, Callback && putNGramBase)
|
||||||
{
|
{
|
||||||
struct Chars
|
struct Chars
|
||||||
{
|
{
|
||||||
@ -115,7 +115,7 @@ namespace VolnitskyTraits
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Callback>
|
template <typename Callback>
|
||||||
static inline bool putNGramUTF8CaseInsensitive(
|
static bool putNGramUTF8CaseInsensitive(
|
||||||
const UInt8 * pos, int offset, const UInt8 * begin, size_t size, Callback && putNGramBase)
|
const UInt8 * pos, int offset, const UInt8 * begin, size_t size, Callback && putNGramBase)
|
||||||
{
|
{
|
||||||
const UInt8 * end = begin + size;
|
const UInt8 * end = begin + size;
|
||||||
@ -349,7 +349,7 @@ namespace VolnitskyTraits
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <bool CaseSensitive, bool ASCII, typename Callback>
|
template <bool CaseSensitive, bool ASCII, typename Callback>
|
||||||
static inline bool putNGram(const UInt8 * pos, int offset, [[maybe_unused]] const UInt8 * begin, size_t size, Callback && putNGramBase)
|
static bool putNGram(const UInt8 * pos, int offset, [[maybe_unused]] const UInt8 * begin, size_t size, Callback && putNGramBase)
|
||||||
{
|
{
|
||||||
if constexpr (CaseSensitive)
|
if constexpr (CaseSensitive)
|
||||||
{
|
{
|
||||||
@ -580,7 +580,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool searchOne(const UInt8 * haystack, const UInt8 * haystack_end) const
|
bool searchOne(const UInt8 * haystack, const UInt8 * haystack_end) const
|
||||||
{
|
{
|
||||||
const size_t fallback_size = fallback_needles.size();
|
const size_t fallback_size = fallback_needles.size();
|
||||||
for (size_t i = 0; i < fallback_size; ++i)
|
for (size_t i = 0; i < fallback_size; ++i)
|
||||||
@ -609,7 +609,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t searchOneFirstIndex(const UInt8 * haystack, const UInt8 * haystack_end) const
|
size_t searchOneFirstIndex(const UInt8 * haystack, const UInt8 * haystack_end) const
|
||||||
{
|
{
|
||||||
const size_t fallback_size = fallback_needles.size();
|
const size_t fallback_size = fallback_needles.size();
|
||||||
|
|
||||||
@ -647,7 +647,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename CountCharsCallback>
|
template <typename CountCharsCallback>
|
||||||
inline UInt64 searchOneFirstPosition(const UInt8 * haystack, const UInt8 * haystack_end, const CountCharsCallback & count_chars) const
|
UInt64 searchOneFirstPosition(const UInt8 * haystack, const UInt8 * haystack_end, const CountCharsCallback & count_chars) const
|
||||||
{
|
{
|
||||||
const size_t fallback_size = fallback_needles.size();
|
const size_t fallback_size = fallback_needles.size();
|
||||||
|
|
||||||
@ -682,7 +682,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename CountCharsCallback, typename AnsType>
|
template <typename CountCharsCallback, typename AnsType>
|
||||||
inline void searchOneAll(const UInt8 * haystack, const UInt8 * haystack_end, AnsType * answer, const CountCharsCallback & count_chars) const
|
void searchOneAll(const UInt8 * haystack, const UInt8 * haystack_end, AnsType * answer, const CountCharsCallback & count_chars) const
|
||||||
{
|
{
|
||||||
const size_t fallback_size = fallback_needles.size();
|
const size_t fallback_size = fallback_needles.size();
|
||||||
for (size_t i = 0; i < fallback_size; ++i)
|
for (size_t i = 0; i < fallback_size; ++i)
|
||||||
|
@ -491,12 +491,12 @@ public:
|
|||||||
incrementErrorMetrics(code);
|
incrementErrorMetrics(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static Exception createDeprecated(const std::string & msg, Error code_)
|
static Exception createDeprecated(const std::string & msg, Error code_)
|
||||||
{
|
{
|
||||||
return Exception(msg, code_, 0);
|
return Exception(msg, code_, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static Exception fromPath(Error code_, const std::string & path)
|
static Exception fromPath(Error code_, const std::string & path)
|
||||||
{
|
{
|
||||||
return Exception(code_, "Coordination error: {}, path {}", errorMessage(code_), path);
|
return Exception(code_, "Coordination error: {}, path {}", errorMessage(code_), path);
|
||||||
}
|
}
|
||||||
@ -504,7 +504,7 @@ public:
|
|||||||
/// Message must be a compile-time constant
|
/// Message must be a compile-time constant
|
||||||
template <typename T>
|
template <typename T>
|
||||||
requires std::is_convertible_v<T, String>
|
requires std::is_convertible_v<T, String>
|
||||||
inline static Exception fromMessage(Error code_, T && message)
|
static Exception fromMessage(Error code_, T && message)
|
||||||
{
|
{
|
||||||
return Exception(std::forward<T>(message), code_);
|
return Exception(std::forward<T>(message), code_);
|
||||||
}
|
}
|
||||||
|
@ -11,13 +11,13 @@ namespace DB
|
|||||||
template <has_find_extreme_implementation T>
|
template <has_find_extreme_implementation T>
|
||||||
struct MinComparator
|
struct MinComparator
|
||||||
{
|
{
|
||||||
static ALWAYS_INLINE inline const T & cmp(const T & a, const T & b) { return std::min(a, b); }
|
static ALWAYS_INLINE const T & cmp(const T & a, const T & b) { return std::min(a, b); }
|
||||||
};
|
};
|
||||||
|
|
||||||
template <has_find_extreme_implementation T>
|
template <has_find_extreme_implementation T>
|
||||||
struct MaxComparator
|
struct MaxComparator
|
||||||
{
|
{
|
||||||
static ALWAYS_INLINE inline const T & cmp(const T & a, const T & b) { return std::max(a, b); }
|
static ALWAYS_INLINE const T & cmp(const T & a, const T & b) { return std::max(a, b); }
|
||||||
};
|
};
|
||||||
|
|
||||||
MULTITARGET_FUNCTION_AVX2_SSE42(
|
MULTITARGET_FUNCTION_AVX2_SSE42(
|
||||||
|
@ -855,13 +855,13 @@ template <> struct Field::EnumToType<Field::Types::AggregateFunctionState> { usi
|
|||||||
template <> struct Field::EnumToType<Field::Types::CustomType> { using Type = CustomType; };
|
template <> struct Field::EnumToType<Field::Types::CustomType> { using Type = CustomType; };
|
||||||
template <> struct Field::EnumToType<Field::Types::Bool> { using Type = UInt64; };
|
template <> struct Field::EnumToType<Field::Types::Bool> { using Type = UInt64; };
|
||||||
|
|
||||||
inline constexpr bool isInt64OrUInt64FieldType(Field::Types::Which t)
|
constexpr bool isInt64OrUInt64FieldType(Field::Types::Which t)
|
||||||
{
|
{
|
||||||
return t == Field::Types::Int64
|
return t == Field::Types::Int64
|
||||||
|| t == Field::Types::UInt64;
|
|| t == Field::Types::UInt64;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr bool isInt64OrUInt64orBoolFieldType(Field::Types::Which t)
|
constexpr bool isInt64OrUInt64orBoolFieldType(Field::Types::Which t)
|
||||||
{
|
{
|
||||||
return t == Field::Types::Int64
|
return t == Field::Types::Int64
|
||||||
|| t == Field::Types::UInt64
|
|| t == Field::Types::UInt64
|
||||||
|
@ -19,16 +19,16 @@ enum class JoinKind : uint8_t
|
|||||||
|
|
||||||
const char * toString(JoinKind kind);
|
const char * toString(JoinKind kind);
|
||||||
|
|
||||||
inline constexpr bool isLeft(JoinKind kind) { return kind == JoinKind::Left; }
|
constexpr bool isLeft(JoinKind kind) { return kind == JoinKind::Left; }
|
||||||
inline constexpr bool isRight(JoinKind kind) { return kind == JoinKind::Right; }
|
constexpr bool isRight(JoinKind kind) { return kind == JoinKind::Right; }
|
||||||
inline constexpr bool isInner(JoinKind kind) { return kind == JoinKind::Inner; }
|
constexpr bool isInner(JoinKind kind) { return kind == JoinKind::Inner; }
|
||||||
inline constexpr bool isFull(JoinKind kind) { return kind == JoinKind::Full; }
|
constexpr bool isFull(JoinKind kind) { return kind == JoinKind::Full; }
|
||||||
inline constexpr bool isCrossOrComma(JoinKind kind) { return kind == JoinKind::Comma || kind == JoinKind::Cross; }
|
constexpr bool isCrossOrComma(JoinKind kind) { return kind == JoinKind::Comma || kind == JoinKind::Cross; }
|
||||||
inline constexpr bool isRightOrFull(JoinKind kind) { return kind == JoinKind::Right || kind == JoinKind::Full; }
|
constexpr bool isRightOrFull(JoinKind kind) { return kind == JoinKind::Right || kind == JoinKind::Full; }
|
||||||
inline constexpr bool isLeftOrFull(JoinKind kind) { return kind == JoinKind::Left || kind == JoinKind::Full; }
|
constexpr bool isLeftOrFull(JoinKind kind) { return kind == JoinKind::Left || kind == JoinKind::Full; }
|
||||||
inline constexpr bool isInnerOrRight(JoinKind kind) { return kind == JoinKind::Inner || kind == JoinKind::Right; }
|
constexpr bool isInnerOrRight(JoinKind kind) { return kind == JoinKind::Inner || kind == JoinKind::Right; }
|
||||||
inline constexpr bool isInnerOrLeft(JoinKind kind) { return kind == JoinKind::Inner || kind == JoinKind::Left; }
|
constexpr bool isInnerOrLeft(JoinKind kind) { return kind == JoinKind::Inner || kind == JoinKind::Left; }
|
||||||
inline constexpr bool isPaste(JoinKind kind) { return kind == JoinKind::Paste; }
|
constexpr bool isPaste(JoinKind kind) { return kind == JoinKind::Paste; }
|
||||||
|
|
||||||
/// Allows more optimal JOIN for typical cases.
|
/// Allows more optimal JOIN for typical cases.
|
||||||
enum class JoinStrictness : uint8_t
|
enum class JoinStrictness : uint8_t
|
||||||
@ -66,7 +66,7 @@ enum class ASOFJoinInequality : uint8_t
|
|||||||
|
|
||||||
const char * toString(ASOFJoinInequality asof_join_inequality);
|
const char * toString(ASOFJoinInequality asof_join_inequality);
|
||||||
|
|
||||||
inline constexpr ASOFJoinInequality getASOFJoinInequality(std::string_view func_name)
|
constexpr ASOFJoinInequality getASOFJoinInequality(std::string_view func_name)
|
||||||
{
|
{
|
||||||
ASOFJoinInequality inequality = ASOFJoinInequality::None;
|
ASOFJoinInequality inequality = ASOFJoinInequality::None;
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ inline constexpr ASOFJoinInequality getASOFJoinInequality(std::string_view func_
|
|||||||
return inequality;
|
return inequality;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr ASOFJoinInequality reverseASOFJoinInequality(ASOFJoinInequality inequality)
|
constexpr ASOFJoinInequality reverseASOFJoinInequality(ASOFJoinInequality inequality)
|
||||||
{
|
{
|
||||||
if (inequality == ASOFJoinInequality::Less)
|
if (inequality == ASOFJoinInequality::Less)
|
||||||
return ASOFJoinInequality::Greater;
|
return ASOFJoinInequality::Greater;
|
||||||
|
@ -40,7 +40,7 @@ class BaseDaemon : public Poco::Util::ServerApplication, public Loggers
|
|||||||
friend class SignalListener;
|
friend class SignalListener;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static inline constexpr char DEFAULT_GRAPHITE_CONFIG_NAME[] = "graphite";
|
static constexpr char DEFAULT_GRAPHITE_CONFIG_NAME[] = "graphite";
|
||||||
|
|
||||||
BaseDaemon();
|
BaseDaemon();
|
||||||
~BaseDaemon() override;
|
~BaseDaemon() override;
|
||||||
|
@ -147,7 +147,7 @@ public:
|
|||||||
|
|
||||||
static T getScaleMultiplier(UInt32 scale);
|
static T getScaleMultiplier(UInt32 scale);
|
||||||
|
|
||||||
inline DecimalUtils::DataTypeDecimalTrait<T> getTrait() const
|
DecimalUtils::DataTypeDecimalTrait<T> getTrait() const
|
||||||
{
|
{
|
||||||
return {precision, scale};
|
return {precision, scale};
|
||||||
}
|
}
|
||||||
|
@ -754,7 +754,7 @@ private:
|
|||||||
|
|
||||||
std::vector<Attribute> attributes;
|
std::vector<Attribute> attributes;
|
||||||
|
|
||||||
inline void setCellDeadline(Cell & cell, TimePoint now)
|
void setCellDeadline(Cell & cell, TimePoint now)
|
||||||
{
|
{
|
||||||
if (configuration.lifetime.min_sec == 0 && configuration.lifetime.max_sec == 0)
|
if (configuration.lifetime.min_sec == 0 && configuration.lifetime.max_sec == 0)
|
||||||
{
|
{
|
||||||
@ -774,7 +774,7 @@ private:
|
|||||||
cell.deadline = std::chrono::system_clock::to_time_t(deadline);
|
cell.deadline = std::chrono::system_clock::to_time_t(deadline);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t getCellIndex(const KeyType key) const
|
size_t getCellIndex(const KeyType key) const
|
||||||
{
|
{
|
||||||
const size_t hash = DefaultHash<KeyType>()(key);
|
const size_t hash = DefaultHash<KeyType>()(key);
|
||||||
const size_t index = hash & size_overlap_mask;
|
const size_t index = hash & size_overlap_mask;
|
||||||
@ -783,7 +783,7 @@ private:
|
|||||||
|
|
||||||
using KeyStateAndCellIndex = std::pair<KeyState::State, size_t>;
|
using KeyStateAndCellIndex = std::pair<KeyState::State, size_t>;
|
||||||
|
|
||||||
inline KeyStateAndCellIndex getKeyStateAndCellIndex(const KeyType key, const time_t now) const
|
KeyStateAndCellIndex getKeyStateAndCellIndex(const KeyType key, const time_t now) const
|
||||||
{
|
{
|
||||||
size_t place_value = getCellIndex(key);
|
size_t place_value = getCellIndex(key);
|
||||||
const size_t place_value_end = place_value + max_collision_length;
|
const size_t place_value_end = place_value + max_collision_length;
|
||||||
@ -810,7 +810,7 @@ private:
|
|||||||
return std::make_pair(KeyState::not_found, place_value & size_overlap_mask);
|
return std::make_pair(KeyState::not_found, place_value & size_overlap_mask);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t getCellIndexForInsert(const KeyType & key) const
|
size_t getCellIndexForInsert(const KeyType & key) const
|
||||||
{
|
{
|
||||||
size_t place_value = getCellIndex(key);
|
size_t place_value = getCellIndex(key);
|
||||||
const size_t place_value_end = place_value + max_collision_length;
|
const size_t place_value_end = place_value + max_collision_length;
|
||||||
|
@ -44,7 +44,7 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool isConstant() const { return default_values_column == nullptr; }
|
bool isConstant() const { return default_values_column == nullptr; }
|
||||||
|
|
||||||
Field getDefaultValue(size_t row) const
|
Field getDefaultValue(size_t row) const
|
||||||
{
|
{
|
||||||
@ -450,17 +450,17 @@ public:
|
|||||||
keys_size = key_columns.front()->size();
|
keys_size = key_columns.front()->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t getKeysSize() const
|
size_t getKeysSize() const
|
||||||
{
|
{
|
||||||
return keys_size;
|
return keys_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t getCurrentKeyIndex() const
|
size_t getCurrentKeyIndex() const
|
||||||
{
|
{
|
||||||
return current_key_index;
|
return current_key_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline KeyType extractCurrentKey()
|
KeyType extractCurrentKey()
|
||||||
{
|
{
|
||||||
assert(current_key_index < keys_size);
|
assert(current_key_index < keys_size);
|
||||||
|
|
||||||
|
@ -48,14 +48,14 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static inline constexpr const char * languages[] =
|
static constexpr const char * languages[] =
|
||||||
{
|
{
|
||||||
#define M(NAME, FALLBACK, NUM) #NAME,
|
#define M(NAME, FALLBACK, NUM) #NAME,
|
||||||
FOR_EACH_LANGUAGE(M)
|
FOR_EACH_LANGUAGE(M)
|
||||||
#undef M
|
#undef M
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline constexpr Language fallbacks[] =
|
static constexpr Language fallbacks[] =
|
||||||
{
|
{
|
||||||
#define M(NAME, FALLBACK, NUM) Language::FALLBACK,
|
#define M(NAME, FALLBACK, NUM) Language::FALLBACK,
|
||||||
FOR_EACH_LANGUAGE(M)
|
FOR_EACH_LANGUAGE(M)
|
||||||
|
@ -26,15 +26,15 @@ struct KeyState
|
|||||||
: state(state_)
|
: state(state_)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
inline bool isFound() const { return state == State::found; }
|
bool isFound() const { return state == State::found; }
|
||||||
inline bool isExpired() const { return state == State::expired; }
|
bool isExpired() const { return state == State::expired; }
|
||||||
inline bool isNotFound() const { return state == State::not_found; }
|
bool isNotFound() const { return state == State::not_found; }
|
||||||
inline bool isDefault() const { return is_default; }
|
bool isDefault() const { return is_default; }
|
||||||
inline void setDefault() { is_default = true; }
|
void setDefault() { is_default = true; }
|
||||||
inline void setDefaultValue(bool is_default_value) { is_default = is_default_value; }
|
void setDefaultValue(bool is_default_value) { is_default = is_default_value; }
|
||||||
/// Valid only if keyState is found or expired
|
/// Valid only if keyState is found or expired
|
||||||
inline size_t getFetchedColumnIndex() const { return fetched_column_index; }
|
size_t getFetchedColumnIndex() const { return fetched_column_index; }
|
||||||
inline void setFetchedColumnIndex(size_t fetched_column_index_value) { fetched_column_index = fetched_column_index_value; }
|
void setFetchedColumnIndex(size_t fetched_column_index_value) { fetched_column_index = fetched_column_index_value; }
|
||||||
private:
|
private:
|
||||||
State state = not_found;
|
State state = not_found;
|
||||||
size_t fetched_column_index = 0;
|
size_t fetched_column_index = 0;
|
||||||
|
@ -66,7 +66,7 @@ namespace
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline UInt8 prefixIPv6() const
|
UInt8 prefixIPv6() const
|
||||||
{
|
{
|
||||||
return isv6 ? prefix : prefix + 96;
|
return isv6 ? prefix : prefix + 96;
|
||||||
}
|
}
|
||||||
|
@ -474,7 +474,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Checks if no more values can be added for a given attribute
|
// Checks if no more values can be added for a given attribute
|
||||||
inline bool full(const String & attr_name, std::unordered_set<String> * const defaults = nullptr) const
|
bool full(const String & attr_name, std::unordered_set<String> * const defaults = nullptr) const
|
||||||
{
|
{
|
||||||
if (collect_values_limit)
|
if (collect_values_limit)
|
||||||
{
|
{
|
||||||
@ -490,7 +490,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Returns the number of full attributes
|
// Returns the number of full attributes
|
||||||
inline size_t attributesFull() const { return n_full_attributes; }
|
size_t attributesFull() const { return n_full_attributes; }
|
||||||
};
|
};
|
||||||
|
|
||||||
std::pair<String, bool> processBackRefs(const String & data, const re2::RE2 & searcher, const std::vector<StringPiece> & pieces)
|
std::pair<String, bool> processBackRefs(const String & data, const re2::RE2 & searcher, const std::vector<StringPiece> & pieces)
|
||||||
|
@ -134,7 +134,7 @@ public:
|
|||||||
|
|
||||||
/// Reset block with new block_data
|
/// Reset block with new block_data
|
||||||
/// block_data must be filled with zeroes if it is new block
|
/// block_data must be filled with zeroes if it is new block
|
||||||
inline void reset(char * new_block_data)
|
void reset(char * new_block_data)
|
||||||
{
|
{
|
||||||
block_data = new_block_data;
|
block_data = new_block_data;
|
||||||
current_block_offset = block_header_size;
|
current_block_offset = block_header_size;
|
||||||
@ -142,13 +142,13 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check if it is enough place to write key in block
|
/// Check if it is enough place to write key in block
|
||||||
inline bool enoughtPlaceToWriteKey(const SSDCacheSimpleKey & cache_key) const
|
bool enoughtPlaceToWriteKey(const SSDCacheSimpleKey & cache_key) const
|
||||||
{
|
{
|
||||||
return (current_block_offset + (sizeof(cache_key.key) + sizeof(cache_key.size) + cache_key.size)) <= block_size;
|
return (current_block_offset + (sizeof(cache_key.key) + sizeof(cache_key.size) + cache_key.size)) <= block_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if it is enough place to write key in block
|
/// Check if it is enough place to write key in block
|
||||||
inline bool enoughtPlaceToWriteKey(const SSDCacheComplexKey & cache_key) const
|
bool enoughtPlaceToWriteKey(const SSDCacheComplexKey & cache_key) const
|
||||||
{
|
{
|
||||||
const StringRef & key = cache_key.key;
|
const StringRef & key = cache_key.key;
|
||||||
size_t complex_key_size = sizeof(key.size) + key.size;
|
size_t complex_key_size = sizeof(key.size) + key.size;
|
||||||
@ -159,7 +159,7 @@ public:
|
|||||||
/// Write key and returns offset in ssd cache block where data is written
|
/// Write key and returns offset in ssd cache block where data is written
|
||||||
/// It is client responsibility to check if there is enough place in block to write key
|
/// It is client responsibility to check if there is enough place in block to write key
|
||||||
/// Returns true if key was written and false if there was not enough place to write key
|
/// Returns true if key was written and false if there was not enough place to write key
|
||||||
inline bool writeKey(const SSDCacheSimpleKey & cache_key, size_t & offset_in_block)
|
bool writeKey(const SSDCacheSimpleKey & cache_key, size_t & offset_in_block)
|
||||||
{
|
{
|
||||||
assert(cache_key.size > 0);
|
assert(cache_key.size > 0);
|
||||||
|
|
||||||
@ -188,7 +188,7 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool writeKey(const SSDCacheComplexKey & cache_key, size_t & offset_in_block)
|
bool writeKey(const SSDCacheComplexKey & cache_key, size_t & offset_in_block)
|
||||||
{
|
{
|
||||||
assert(cache_key.size > 0);
|
assert(cache_key.size > 0);
|
||||||
|
|
||||||
@ -223,20 +223,20 @@ public:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t getKeysSize() const { return keys_size; }
|
size_t getKeysSize() const { return keys_size; }
|
||||||
|
|
||||||
/// Write keys size into block header
|
/// Write keys size into block header
|
||||||
inline void writeKeysSize()
|
void writeKeysSize()
|
||||||
{
|
{
|
||||||
char * keys_size_offset_data = block_data + block_header_check_sum_size;
|
char * keys_size_offset_data = block_data + block_header_check_sum_size;
|
||||||
std::memcpy(keys_size_offset_data, &keys_size, sizeof(size_t));
|
std::memcpy(keys_size_offset_data, &keys_size, sizeof(size_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get check sum from block header
|
/// Get check sum from block header
|
||||||
inline size_t getCheckSum() const { return unalignedLoad<size_t>(block_data); }
|
size_t getCheckSum() const { return unalignedLoad<size_t>(block_data); }
|
||||||
|
|
||||||
/// Calculate check sum in block
|
/// Calculate check sum in block
|
||||||
inline size_t calculateCheckSum() const
|
size_t calculateCheckSum() const
|
||||||
{
|
{
|
||||||
size_t calculated_check_sum = static_cast<size_t>(CityHash_v1_0_2::CityHash64(block_data + block_header_check_sum_size, block_size - block_header_check_sum_size));
|
size_t calculated_check_sum = static_cast<size_t>(CityHash_v1_0_2::CityHash64(block_data + block_header_check_sum_size, block_size - block_header_check_sum_size));
|
||||||
|
|
||||||
@ -244,7 +244,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Check if check sum from block header matched calculated check sum in block
|
/// Check if check sum from block header matched calculated check sum in block
|
||||||
inline bool checkCheckSum() const
|
bool checkCheckSum() const
|
||||||
{
|
{
|
||||||
size_t calculated_check_sum = calculateCheckSum();
|
size_t calculated_check_sum = calculateCheckSum();
|
||||||
size_t check_sum = getCheckSum();
|
size_t check_sum = getCheckSum();
|
||||||
@ -253,16 +253,16 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Write check sum in block header
|
/// Write check sum in block header
|
||||||
inline void writeCheckSum()
|
void writeCheckSum()
|
||||||
{
|
{
|
||||||
size_t check_sum = static_cast<size_t>(CityHash_v1_0_2::CityHash64(block_data + block_header_check_sum_size, block_size - block_header_check_sum_size));
|
size_t check_sum = static_cast<size_t>(CityHash_v1_0_2::CityHash64(block_data + block_header_check_sum_size, block_size - block_header_check_sum_size));
|
||||||
std::memcpy(block_data, &check_sum, sizeof(size_t));
|
std::memcpy(block_data, &check_sum, sizeof(size_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t getBlockSize() const { return block_size; }
|
size_t getBlockSize() const { return block_size; }
|
||||||
|
|
||||||
/// Returns block data
|
/// Returns block data
|
||||||
inline char * getBlockData() const { return block_data; }
|
char * getBlockData() const { return block_data; }
|
||||||
|
|
||||||
/// Read keys that were serialized in block
|
/// Read keys that were serialized in block
|
||||||
/// It is client responsibility to ensure that simple or complex keys were written in block
|
/// It is client responsibility to ensure that simple or complex keys were written in block
|
||||||
@ -405,16 +405,16 @@ public:
|
|||||||
current_write_block.writeCheckSum();
|
current_write_block.writeCheckSum();
|
||||||
}
|
}
|
||||||
|
|
||||||
inline char * getPlace(SSDCacheIndex index) const
|
char * getPlace(SSDCacheIndex index) const
|
||||||
{
|
{
|
||||||
return buffer.m_data + index.block_index * block_size + index.offset_in_block;
|
return buffer.m_data + index.block_index * block_size + index.offset_in_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t getCurrentBlockIndex() const { return current_block_index; }
|
size_t getCurrentBlockIndex() const { return current_block_index; }
|
||||||
|
|
||||||
inline const char * getData() const { return buffer.m_data; }
|
const char * getData() const { return buffer.m_data; }
|
||||||
|
|
||||||
inline size_t getSizeInBytes() const { return block_size * partition_blocks_size; }
|
size_t getSizeInBytes() const { return block_size * partition_blocks_size; }
|
||||||
|
|
||||||
void readKeys(PaddedPODArray<KeyType> & keys) const
|
void readKeys(PaddedPODArray<KeyType> & keys) const
|
||||||
{
|
{
|
||||||
@ -431,7 +431,7 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
current_block_index = 0;
|
current_block_index = 0;
|
||||||
current_write_block.reset(buffer.m_data);
|
current_write_block.reset(buffer.m_data);
|
||||||
@ -751,9 +751,9 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline size_t getCurrentBlockIndex() const { return current_block_index; }
|
size_t getCurrentBlockIndex() const { return current_block_index; }
|
||||||
|
|
||||||
inline void reset()
|
void reset()
|
||||||
{
|
{
|
||||||
current_block_index = 0;
|
current_block_index = 0;
|
||||||
}
|
}
|
||||||
@ -789,7 +789,7 @@ private:
|
|||||||
int fd = -1;
|
int fd = -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline static int preallocateDiskSpace(int fd, size_t offset, size_t len)
|
static int preallocateDiskSpace(int fd, size_t offset, size_t len)
|
||||||
{
|
{
|
||||||
#if defined(OS_FREEBSD)
|
#if defined(OS_FREEBSD)
|
||||||
return posix_fallocate(fd, offset, len);
|
return posix_fallocate(fd, offset, len);
|
||||||
@ -798,7 +798,7 @@ private:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static char * getRequestBuffer(const iocb & request)
|
static char * getRequestBuffer(const iocb & request)
|
||||||
{
|
{
|
||||||
char * result = nullptr;
|
char * result = nullptr;
|
||||||
|
|
||||||
@ -811,7 +811,7 @@ private:
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline static ssize_t eventResult(io_event & event)
|
static ssize_t eventResult(io_event & event)
|
||||||
{
|
{
|
||||||
ssize_t bytes_written;
|
ssize_t bytes_written;
|
||||||
|
|
||||||
@ -986,9 +986,9 @@ private:
|
|||||||
size_t in_memory_partition_index;
|
size_t in_memory_partition_index;
|
||||||
CellState state;
|
CellState state;
|
||||||
|
|
||||||
inline bool isInMemory() const { return state == in_memory; }
|
bool isInMemory() const { return state == in_memory; }
|
||||||
inline bool isOnDisk() const { return state == on_disk; }
|
bool isOnDisk() const { return state == on_disk; }
|
||||||
inline bool isDefaultValue() const { return state == default_value; }
|
bool isDefaultValue() const { return state == default_value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct KeyToBlockOffset
|
struct KeyToBlockOffset
|
||||||
@ -1367,7 +1367,7 @@ private:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void setCellDeadline(Cell & cell, TimePoint now)
|
void setCellDeadline(Cell & cell, TimePoint now)
|
||||||
{
|
{
|
||||||
if (configuration.lifetime.min_sec == 0 && configuration.lifetime.max_sec == 0)
|
if (configuration.lifetime.min_sec == 0 && configuration.lifetime.max_sec == 0)
|
||||||
{
|
{
|
||||||
@ -1384,7 +1384,7 @@ private:
|
|||||||
cell.deadline = std::chrono::system_clock::to_time_t(deadline);
|
cell.deadline = std::chrono::system_clock::to_time_t(deadline);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void eraseKeyFromIndex(KeyType key)
|
void eraseKeyFromIndex(KeyType key)
|
||||||
{
|
{
|
||||||
auto it = index.find(key);
|
auto it = index.find(key);
|
||||||
|
|
||||||
|
@ -61,12 +61,12 @@ private:
|
|||||||
|
|
||||||
void monitorRing();
|
void monitorRing();
|
||||||
|
|
||||||
template<typename T> inline void failPromise(std::promise<T> & promise, const Exception & ex)
|
template<typename T> void failPromise(std::promise<T> & promise, const Exception & ex)
|
||||||
{
|
{
|
||||||
promise.set_exception(std::make_exception_ptr(ex));
|
promise.set_exception(std::make_exception_ptr(ex));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline std::future<Result> makeFailedResult(const Exception & ex)
|
std::future<Result> makeFailedResult(const Exception & ex)
|
||||||
{
|
{
|
||||||
auto promise = std::promise<Result>{};
|
auto promise = std::promise<Result>{};
|
||||||
failPromise(promise, ex);
|
failPromise(promise, ex);
|
||||||
|
@ -68,7 +68,7 @@ struct DivideIntegralImpl
|
|||||||
static const constexpr bool allow_string_integer = false;
|
static const constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline Result apply(A a, B b)
|
static Result apply(A a, B b)
|
||||||
{
|
{
|
||||||
using CastA = std::conditional_t<is_big_int_v<B> && std::is_same_v<A, UInt8>, uint8_t, A>;
|
using CastA = std::conditional_t<is_big_int_v<B> && std::is_same_v<A, UInt8>, uint8_t, A>;
|
||||||
using CastB = std::conditional_t<is_big_int_v<A> && std::is_same_v<B, UInt8>, uint8_t, B>;
|
using CastB = std::conditional_t<is_big_int_v<A> && std::is_same_v<B, UInt8>, uint8_t, B>;
|
||||||
@ -120,7 +120,7 @@ struct ModuloImpl
|
|||||||
static const constexpr bool allow_string_integer = false;
|
static const constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline Result apply(A a, B b)
|
static Result apply(A a, B b)
|
||||||
{
|
{
|
||||||
if constexpr (std::is_floating_point_v<ResultType>)
|
if constexpr (std::is_floating_point_v<ResultType>)
|
||||||
{
|
{
|
||||||
@ -175,7 +175,7 @@ struct PositiveModuloImpl : ModuloImpl<A, B>
|
|||||||
using ResultType = typename NumberTraits::ResultOfPositiveModulo<A, B>::Type;
|
using ResultType = typename NumberTraits::ResultOfPositiveModulo<A, B>::Type;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline Result apply(A a, B b)
|
static Result apply(A a, B b)
|
||||||
{
|
{
|
||||||
auto res = ModuloImpl<A, B>::template apply<OriginResultType>(a, b);
|
auto res = ModuloImpl<A, B>::template apply<OriginResultType>(a, b);
|
||||||
if constexpr (is_signed_v<A>)
|
if constexpr (is_signed_v<A>)
|
||||||
|
@ -20,7 +20,7 @@ namespace DB
|
|||||||
// includes extracting ASCII ngram, UTF8 ngram, ASCII word and UTF8 word
|
// includes extracting ASCII ngram, UTF8 ngram, ASCII word and UTF8 word
|
||||||
struct ExtractStringImpl
|
struct ExtractStringImpl
|
||||||
{
|
{
|
||||||
static ALWAYS_INLINE inline const UInt8 * readOneWord(const UInt8 *& pos, const UInt8 * end)
|
static ALWAYS_INLINE const UInt8 * readOneWord(const UInt8 *& pos, const UInt8 * end)
|
||||||
{
|
{
|
||||||
// jump separators
|
// jump separators
|
||||||
while (pos < end && isUTF8Sep(*pos))
|
while (pos < end && isUTF8Sep(*pos))
|
||||||
@ -35,10 +35,10 @@ struct ExtractStringImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
// we use ASCII non-alphanum character as UTF8 separator
|
// we use ASCII non-alphanum character as UTF8 separator
|
||||||
static ALWAYS_INLINE inline bool isUTF8Sep(const UInt8 c) { return c < 128 && !isAlphaNumericASCII(c); }
|
static ALWAYS_INLINE bool isUTF8Sep(const UInt8 c) { return c < 128 && !isAlphaNumericASCII(c); }
|
||||||
|
|
||||||
// read one UTF8 character
|
// read one UTF8 character
|
||||||
static ALWAYS_INLINE inline void readOneUTF8Code(const UInt8 *& pos, const UInt8 * end)
|
static ALWAYS_INLINE void readOneUTF8Code(const UInt8 *& pos, const UInt8 * end)
|
||||||
{
|
{
|
||||||
size_t length = UTF8::seqLength(*pos);
|
size_t length = UTF8::seqLength(*pos);
|
||||||
|
|
||||||
|
@ -284,7 +284,7 @@ struct BinaryOperation
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
template <OpCase op_case>
|
template <OpCase op_case>
|
||||||
static inline void apply(const A * __restrict a, const B * __restrict b, ResultType * __restrict c, size_t i)
|
static void apply(const A * __restrict a, const B * __restrict b, ResultType * __restrict c, size_t i)
|
||||||
{
|
{
|
||||||
if constexpr (op_case == OpCase::Vector)
|
if constexpr (op_case == OpCase::Vector)
|
||||||
c[i] = Op::template apply<ResultType>(a[i], b[i]);
|
c[i] = Op::template apply<ResultType>(a[i], b[i]);
|
||||||
@ -432,7 +432,7 @@ template <typename Op>
|
|||||||
struct FixedStringReduceOperationImpl
|
struct FixedStringReduceOperationImpl
|
||||||
{
|
{
|
||||||
template <OpCase op_case>
|
template <OpCase op_case>
|
||||||
static void inline process(const UInt8 * __restrict a, const UInt8 * __restrict b, UInt16 * __restrict result, size_t size, size_t N)
|
static void process(const UInt8 * __restrict a, const UInt8 * __restrict b, UInt16 * __restrict result, size_t size, size_t N)
|
||||||
{
|
{
|
||||||
if constexpr (op_case == OpCase::Vector)
|
if constexpr (op_case == OpCase::Vector)
|
||||||
vectorVector(a, b, result, size, N);
|
vectorVector(a, b, result, size, N);
|
||||||
@ -503,7 +503,7 @@ struct StringReduceOperationImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline UInt64 constConst(std::string_view a, std::string_view b)
|
static UInt64 constConst(std::string_view a, std::string_view b)
|
||||||
{
|
{
|
||||||
return process(
|
return process(
|
||||||
reinterpret_cast<const UInt8 *>(a.data()),
|
reinterpret_cast<const UInt8 *>(a.data()),
|
||||||
@ -643,7 +643,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
template <OpCase op_case, typename ApplyFunc>
|
template <OpCase op_case, typename ApplyFunc>
|
||||||
static inline void processWithRightNullmapImpl(const auto & a, const auto & b, ResultContainerType & c, size_t size, const NullMap * right_nullmap, ApplyFunc apply_func)
|
static void processWithRightNullmapImpl(const auto & a, const auto & b, ResultContainerType & c, size_t size, const NullMap * right_nullmap, ApplyFunc apply_func)
|
||||||
{
|
{
|
||||||
if (right_nullmap)
|
if (right_nullmap)
|
||||||
{
|
{
|
||||||
|
@ -44,27 +44,27 @@ class DefaultJSONStringSerializer
|
|||||||
public:
|
public:
|
||||||
explicit DefaultJSONStringSerializer(ColumnString & col_str_) : col_str(col_str_) { }
|
explicit DefaultJSONStringSerializer(ColumnString & col_str_) : col_str(col_str_) { }
|
||||||
|
|
||||||
inline void addRawData(const char * ptr, size_t len)
|
void addRawData(const char * ptr, size_t len)
|
||||||
{
|
{
|
||||||
out << std::string_view(ptr, len);
|
out << std::string_view(ptr, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void addRawString(std::string_view str)
|
void addRawString(std::string_view str)
|
||||||
{
|
{
|
||||||
out << str;
|
out << str;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// serialize the json element into stringstream
|
/// serialize the json element into stringstream
|
||||||
inline void addElement(const Element & element)
|
void addElement(const Element & element)
|
||||||
{
|
{
|
||||||
out << element.getElement();
|
out << element.getElement();
|
||||||
}
|
}
|
||||||
inline void commit()
|
void commit()
|
||||||
{
|
{
|
||||||
auto out_str = out.str();
|
auto out_str = out.str();
|
||||||
col_str.insertData(out_str.data(), out_str.size());
|
col_str.insertData(out_str.data(), out_str.size());
|
||||||
}
|
}
|
||||||
inline void rollback() {}
|
void rollback() {}
|
||||||
private:
|
private:
|
||||||
ColumnString & col_str;
|
ColumnString & col_str;
|
||||||
std::stringstream out; // STYLE_CHECK_ALLOW_STD_STRING_STREAM
|
std::stringstream out; // STYLE_CHECK_ALLOW_STD_STRING_STREAM
|
||||||
@ -82,27 +82,27 @@ public:
|
|||||||
prev_offset = offsets.empty() ? 0 : offsets.back();
|
prev_offset = offsets.empty() ? 0 : offsets.back();
|
||||||
}
|
}
|
||||||
/// Put the data into column's buffer directly.
|
/// Put the data into column's buffer directly.
|
||||||
inline void addRawData(const char * ptr, size_t len)
|
void addRawData(const char * ptr, size_t len)
|
||||||
{
|
{
|
||||||
chars.insert(ptr, ptr + len);
|
chars.insert(ptr, ptr + len);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void addRawString(std::string_view str)
|
void addRawString(std::string_view str)
|
||||||
{
|
{
|
||||||
chars.insert(str.data(), str.data() + str.size());
|
chars.insert(str.data(), str.data() + str.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// serialize the json element into column's buffer directly
|
/// serialize the json element into column's buffer directly
|
||||||
inline void addElement(const Element & element)
|
void addElement(const Element & element)
|
||||||
{
|
{
|
||||||
formatter.append(element.getElement());
|
formatter.append(element.getElement());
|
||||||
}
|
}
|
||||||
inline void commit()
|
void commit()
|
||||||
{
|
{
|
||||||
chars.push_back(0);
|
chars.push_back(0);
|
||||||
offsets.push_back(chars.size());
|
offsets.push_back(chars.size());
|
||||||
}
|
}
|
||||||
inline void rollback()
|
void rollback()
|
||||||
{
|
{
|
||||||
chars.resize(prev_offset);
|
chars.resize(prev_offset);
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@ enum class CipherMode : uint8_t
|
|||||||
template <CipherMode mode>
|
template <CipherMode mode>
|
||||||
struct KeyHolder
|
struct KeyHolder
|
||||||
{
|
{
|
||||||
inline StringRef setKey(size_t cipher_key_size, StringRef key) const
|
StringRef setKey(size_t cipher_key_size, StringRef key) const
|
||||||
{
|
{
|
||||||
if (key.size != cipher_key_size)
|
if (key.size != cipher_key_size)
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Invalid key size: {} expected {}", key.size, cipher_key_size);
|
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Invalid key size: {} expected {}", key.size, cipher_key_size);
|
||||||
@ -71,7 +71,7 @@ struct KeyHolder
|
|||||||
template <>
|
template <>
|
||||||
struct KeyHolder<CipherMode::MySQLCompatibility>
|
struct KeyHolder<CipherMode::MySQLCompatibility>
|
||||||
{
|
{
|
||||||
inline StringRef setKey(size_t cipher_key_size, StringRef key)
|
StringRef setKey(size_t cipher_key_size, StringRef key)
|
||||||
{
|
{
|
||||||
if (key.size < cipher_key_size)
|
if (key.size < cipher_key_size)
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Invalid key size: {} expected {}", key.size, cipher_key_size);
|
throw Exception(ErrorCodes::BAD_ARGUMENTS, "Invalid key size: {} expected {}", key.size, cipher_key_size);
|
||||||
|
@ -79,7 +79,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline static void writeBitmask(T x, WriteBuffer & out)
|
static void writeBitmask(T x, WriteBuffer & out)
|
||||||
{
|
{
|
||||||
using UnsignedT = make_unsigned_t<T>;
|
using UnsignedT = make_unsigned_t<T>;
|
||||||
UnsignedT u_x = x;
|
UnsignedT u_x = x;
|
||||||
|
@ -785,7 +785,7 @@ private:
|
|||||||
|
|
||||||
#include <emmintrin.h>
|
#include <emmintrin.h>
|
||||||
|
|
||||||
static inline void applyCIDRMask(const char * __restrict src, char * __restrict dst_lower, char * __restrict dst_upper, UInt8 bits_to_keep)
|
static void applyCIDRMask(const char * __restrict src, char * __restrict dst_lower, char * __restrict dst_upper, UInt8 bits_to_keep)
|
||||||
{
|
{
|
||||||
__m128i mask = _mm_loadu_si128(reinterpret_cast<const __m128i *>(getCIDRMaskIPv6(bits_to_keep).data()));
|
__m128i mask = _mm_loadu_si128(reinterpret_cast<const __m128i *>(getCIDRMaskIPv6(bits_to_keep).data()));
|
||||||
__m128i lower = _mm_and_si128(_mm_loadu_si128(reinterpret_cast<const __m128i *>(src)), mask);
|
__m128i lower = _mm_and_si128(_mm_loadu_si128(reinterpret_cast<const __m128i *>(src)), mask);
|
||||||
@ -916,7 +916,7 @@ public:
|
|||||||
class FunctionIPv4CIDRToRange : public IFunction
|
class FunctionIPv4CIDRToRange : public IFunction
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
static inline std::pair<UInt32, UInt32> applyCIDRMask(UInt32 src, UInt8 bits_to_keep)
|
static std::pair<UInt32, UInt32> applyCIDRMask(UInt32 src, UInt8 bits_to_keep)
|
||||||
{
|
{
|
||||||
if (bits_to_keep >= 8 * sizeof(UInt32))
|
if (bits_to_keep >= 8 * sizeof(UInt32))
|
||||||
return { src, src };
|
return { src, src };
|
||||||
|
@ -83,7 +83,7 @@ private:
|
|||||||
using BucketsType = typename Impl::BucketsType;
|
using BucketsType = typename Impl::BucketsType;
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline BucketsType checkBucketsRange(T buckets) const
|
BucketsType checkBucketsRange(T buckets) const
|
||||||
{
|
{
|
||||||
if (unlikely(buckets <= 0))
|
if (unlikely(buckets <= 0))
|
||||||
throw Exception(ErrorCodes::BAD_ARGUMENTS, "The second argument of function {} (number of buckets) must be positive number", getName());
|
throw Exception(ErrorCodes::BAD_ARGUMENTS, "The second argument of function {} (number of buckets) must be positive number", getName());
|
||||||
|
@ -31,7 +31,7 @@ extern const int SUPPORT_IS_DISABLED;
|
|||||||
|
|
||||||
struct FunctionDetectLanguageImpl
|
struct FunctionDetectLanguageImpl
|
||||||
{
|
{
|
||||||
static ALWAYS_INLINE inline std::string_view codeISO(std::string_view code_string)
|
static ALWAYS_INLINE std::string_view codeISO(std::string_view code_string)
|
||||||
{
|
{
|
||||||
if (code_string.ends_with("-Latn"))
|
if (code_string.ends_with("-Latn"))
|
||||||
code_string.remove_suffix(code_string.size() - 5);
|
code_string.remove_suffix(code_string.size() - 5);
|
||||||
|
@ -170,7 +170,7 @@ public:
|
|||||||
: vec(in[in.size() - N]->getData()), next(in) {}
|
: vec(in[in.size() - N]->getData()), next(in) {}
|
||||||
|
|
||||||
/// Returns a combination of values in the i-th row of all columns stored in the constructor.
|
/// Returns a combination of values in the i-th row of all columns stored in the constructor.
|
||||||
inline ResultValueType apply(const size_t i) const
|
ResultValueType apply(const size_t i) const
|
||||||
{
|
{
|
||||||
const auto a = !!vec[i];
|
const auto a = !!vec[i];
|
||||||
return Op::apply(a, next.apply(i));
|
return Op::apply(a, next.apply(i));
|
||||||
@ -190,7 +190,7 @@ public:
|
|||||||
explicit AssociativeApplierImpl(const UInt8ColumnPtrs & in)
|
explicit AssociativeApplierImpl(const UInt8ColumnPtrs & in)
|
||||||
: vec(in[in.size() - 1]->getData()) {}
|
: vec(in[in.size() - 1]->getData()) {}
|
||||||
|
|
||||||
inline ResultValueType apply(const size_t i) const { return !!vec[i]; }
|
ResultValueType apply(const size_t i) const { return !!vec[i]; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const UInt8Container & vec;
|
const UInt8Container & vec;
|
||||||
@ -291,7 +291,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a combination of values in the i-th row of all columns stored in the constructor.
|
/// Returns a combination of values in the i-th row of all columns stored in the constructor.
|
||||||
inline ResultValueType apply(const size_t i) const
|
ResultValueType apply(const size_t i) const
|
||||||
{
|
{
|
||||||
return Op::ternaryApply(vec[i], next.apply(i));
|
return Op::ternaryApply(vec[i], next.apply(i));
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ public:
|
|||||||
TernaryValueBuilder::build(in[in.size() - 1], vec.data());
|
TernaryValueBuilder::build(in[in.size() - 1], vec.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ResultValueType apply(const size_t i) const { return vec[i]; }
|
ResultValueType apply(const size_t i) const { return vec[i]; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UInt8Container vec;
|
UInt8Container vec;
|
||||||
|
@ -84,47 +84,47 @@ struct AndImpl
|
|||||||
{
|
{
|
||||||
using ResultType = UInt8;
|
using ResultType = UInt8;
|
||||||
|
|
||||||
static inline constexpr bool isSaturable() { return true; }
|
static constexpr bool isSaturable() { return true; }
|
||||||
|
|
||||||
/// Final value in two-valued logic (no further operations with True, False will change this value)
|
/// Final value in two-valued logic (no further operations with True, False will change this value)
|
||||||
static inline constexpr bool isSaturatedValue(bool a) { return !a; }
|
static constexpr bool isSaturatedValue(bool a) { return !a; }
|
||||||
|
|
||||||
/// Final value in three-valued logic (no further operations with True, False, Null will change this value)
|
/// Final value in three-valued logic (no further operations with True, False, Null will change this value)
|
||||||
static inline constexpr bool isSaturatedValueTernary(UInt8 a) { return a == Ternary::False; }
|
static constexpr bool isSaturatedValueTernary(UInt8 a) { return a == Ternary::False; }
|
||||||
|
|
||||||
static inline constexpr ResultType apply(UInt8 a, UInt8 b) { return a & b; }
|
static constexpr ResultType apply(UInt8 a, UInt8 b) { return a & b; }
|
||||||
|
|
||||||
static inline constexpr ResultType ternaryApply(UInt8 a, UInt8 b) { return std::min(a, b); }
|
static constexpr ResultType ternaryApply(UInt8 a, UInt8 b) { return std::min(a, b); }
|
||||||
|
|
||||||
/// Will use three-valued logic for NULLs (see above) or default implementation (any operation with NULL returns NULL).
|
/// Will use three-valued logic for NULLs (see above) or default implementation (any operation with NULL returns NULL).
|
||||||
static inline constexpr bool specialImplementationForNulls() { return true; }
|
static constexpr bool specialImplementationForNulls() { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct OrImpl
|
struct OrImpl
|
||||||
{
|
{
|
||||||
using ResultType = UInt8;
|
using ResultType = UInt8;
|
||||||
|
|
||||||
static inline constexpr bool isSaturable() { return true; }
|
static constexpr bool isSaturable() { return true; }
|
||||||
static inline constexpr bool isSaturatedValue(bool a) { return a; }
|
static constexpr bool isSaturatedValue(bool a) { return a; }
|
||||||
static inline constexpr bool isSaturatedValueTernary(UInt8 a) { return a == Ternary::True; }
|
static constexpr bool isSaturatedValueTernary(UInt8 a) { return a == Ternary::True; }
|
||||||
static inline constexpr ResultType apply(UInt8 a, UInt8 b) { return a | b; }
|
static constexpr ResultType apply(UInt8 a, UInt8 b) { return a | b; }
|
||||||
static inline constexpr ResultType ternaryApply(UInt8 a, UInt8 b) { return std::max(a, b); }
|
static constexpr ResultType ternaryApply(UInt8 a, UInt8 b) { return std::max(a, b); }
|
||||||
static inline constexpr bool specialImplementationForNulls() { return true; }
|
static constexpr bool specialImplementationForNulls() { return true; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct XorImpl
|
struct XorImpl
|
||||||
{
|
{
|
||||||
using ResultType = UInt8;
|
using ResultType = UInt8;
|
||||||
|
|
||||||
static inline constexpr bool isSaturable() { return false; }
|
static constexpr bool isSaturable() { return false; }
|
||||||
static inline constexpr bool isSaturatedValue(bool) { return false; }
|
static constexpr bool isSaturatedValue(bool) { return false; }
|
||||||
static inline constexpr bool isSaturatedValueTernary(UInt8) { return false; }
|
static constexpr bool isSaturatedValueTernary(UInt8) { return false; }
|
||||||
static inline constexpr ResultType apply(UInt8 a, UInt8 b) { return a != b; }
|
static constexpr ResultType apply(UInt8 a, UInt8 b) { return a != b; }
|
||||||
static inline constexpr ResultType ternaryApply(UInt8 a, UInt8 b) { return a != b; }
|
static constexpr ResultType ternaryApply(UInt8 a, UInt8 b) { return a != b; }
|
||||||
static inline constexpr bool specialImplementationForNulls() { return false; }
|
static constexpr bool specialImplementationForNulls() { return false; }
|
||||||
|
|
||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static inline llvm::Value * apply(llvm::IRBuilder<> & builder, llvm::Value * a, llvm::Value * b)
|
static llvm::Value * apply(llvm::IRBuilder<> & builder, llvm::Value * a, llvm::Value * b)
|
||||||
{
|
{
|
||||||
return builder.CreateXor(a, b);
|
return builder.CreateXor(a, b);
|
||||||
}
|
}
|
||||||
@ -136,13 +136,13 @@ struct NotImpl
|
|||||||
{
|
{
|
||||||
using ResultType = UInt8;
|
using ResultType = UInt8;
|
||||||
|
|
||||||
static inline ResultType apply(A a)
|
static ResultType apply(A a)
|
||||||
{
|
{
|
||||||
return !static_cast<bool>(a);
|
return !static_cast<bool>(a);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static inline llvm::Value * apply(llvm::IRBuilder<> & builder, llvm::Value * a)
|
static llvm::Value * apply(llvm::IRBuilder<> & builder, llvm::Value * a)
|
||||||
{
|
{
|
||||||
return builder.CreateNot(a);
|
return builder.CreateNot(a);
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ namespace DB
|
|||||||
struct FunctionDetectProgrammingLanguageImpl
|
struct FunctionDetectProgrammingLanguageImpl
|
||||||
{
|
{
|
||||||
/// Calculate total weight
|
/// Calculate total weight
|
||||||
static ALWAYS_INLINE inline Float64 stateMachine(
|
static ALWAYS_INLINE Float64 stateMachine(
|
||||||
const FrequencyHolder::Map & standard,
|
const FrequencyHolder::Map & standard,
|
||||||
const std::unordered_map<String, Float64> & model)
|
const std::unordered_map<String, Float64> & model)
|
||||||
{
|
{
|
||||||
|
@ -296,7 +296,7 @@ class FloatRoundingComputation : public BaseFloatRoundingComputation<T>
|
|||||||
using Base = BaseFloatRoundingComputation<T>;
|
using Base = BaseFloatRoundingComputation<T>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static inline void compute(const T * __restrict in, const typename Base::VectorType & scale, T * __restrict out)
|
static void compute(const T * __restrict in, const typename Base::VectorType & scale, T * __restrict out)
|
||||||
{
|
{
|
||||||
auto val = Base::load(in);
|
auto val = Base::load(in);
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ struct Hash
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <bool CaseInsensitive>
|
template <bool CaseInsensitive>
|
||||||
static ALWAYS_INLINE inline UInt64 shingleHash(UInt64 crc, const UInt8 * start, size_t size)
|
static ALWAYS_INLINE UInt64 shingleHash(UInt64 crc, const UInt8 * start, size_t size)
|
||||||
{
|
{
|
||||||
if (size & 1)
|
if (size & 1)
|
||||||
{
|
{
|
||||||
@ -153,7 +153,7 @@ struct Hash
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <bool CaseInsensitive>
|
template <bool CaseInsensitive>
|
||||||
static ALWAYS_INLINE inline UInt64 shingleHash(const std::vector<BytesRef> & shingle, size_t offset = 0)
|
static ALWAYS_INLINE UInt64 shingleHash(const std::vector<BytesRef> & shingle, size_t offset = 0)
|
||||||
{
|
{
|
||||||
UInt64 crc = -1ULL;
|
UInt64 crc = -1ULL;
|
||||||
|
|
||||||
@ -177,14 +177,14 @@ struct SimHashImpl
|
|||||||
static constexpr size_t min_word_size = 4;
|
static constexpr size_t min_word_size = 4;
|
||||||
|
|
||||||
/// Update fingerprint according to hash_value bits.
|
/// Update fingerprint according to hash_value bits.
|
||||||
static ALWAYS_INLINE inline void updateFingerVector(Int64 * finger_vec, UInt64 hash_value)
|
static ALWAYS_INLINE void updateFingerVector(Int64 * finger_vec, UInt64 hash_value)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < 64; ++i)
|
for (size_t i = 0; i < 64; ++i)
|
||||||
finger_vec[i] += (hash_value & (1ULL << i)) ? 1 : -1;
|
finger_vec[i] += (hash_value & (1ULL << i)) ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a 64 bit value according to finger_vec.
|
/// Return a 64 bit value according to finger_vec.
|
||||||
static ALWAYS_INLINE inline UInt64 getSimHash(const Int64 * finger_vec)
|
static ALWAYS_INLINE UInt64 getSimHash(const Int64 * finger_vec)
|
||||||
{
|
{
|
||||||
UInt64 res = 0;
|
UInt64 res = 0;
|
||||||
|
|
||||||
@ -200,7 +200,7 @@ struct SimHashImpl
|
|||||||
// for each ngram, calculate a 64 bit hash value, and update the vector according the hash value
|
// for each ngram, calculate a 64 bit hash value, and update the vector according the hash value
|
||||||
// finally return a 64 bit value(UInt64), i'th bit is 1 means vector[i] > 0, otherwise, vector[i] < 0
|
// finally return a 64 bit value(UInt64), i'th bit is 1 means vector[i] > 0, otherwise, vector[i] < 0
|
||||||
|
|
||||||
static ALWAYS_INLINE inline UInt64 ngramHashASCII(const UInt8 * data, size_t size, size_t shingle_size)
|
static ALWAYS_INLINE UInt64 ngramHashASCII(const UInt8 * data, size_t size, size_t shingle_size)
|
||||||
{
|
{
|
||||||
if (size < shingle_size)
|
if (size < shingle_size)
|
||||||
return Hash::shingleHash<CaseInsensitive>(-1ULL, data, size);
|
return Hash::shingleHash<CaseInsensitive>(-1ULL, data, size);
|
||||||
@ -217,7 +217,7 @@ struct SimHashImpl
|
|||||||
return getSimHash(finger_vec);
|
return getSimHash(finger_vec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ALWAYS_INLINE inline UInt64 ngramHashUTF8(const UInt8 * data, size_t size, size_t shingle_size)
|
static ALWAYS_INLINE UInt64 ngramHashUTF8(const UInt8 * data, size_t size, size_t shingle_size)
|
||||||
{
|
{
|
||||||
const UInt8 * start = data;
|
const UInt8 * start = data;
|
||||||
const UInt8 * end = data + size;
|
const UInt8 * end = data + size;
|
||||||
@ -259,7 +259,7 @@ struct SimHashImpl
|
|||||||
// 2. next, we extract one word each time, and calculate a new hash value of the new word,then use the latest N hash
|
// 2. next, we extract one word each time, and calculate a new hash value of the new word,then use the latest N hash
|
||||||
// values to calculate the next word shingle hash value
|
// values to calculate the next word shingle hash value
|
||||||
|
|
||||||
static ALWAYS_INLINE inline UInt64 wordShingleHash(const UInt8 * data, size_t size, size_t shingle_size)
|
static ALWAYS_INLINE UInt64 wordShingleHash(const UInt8 * data, size_t size, size_t shingle_size)
|
||||||
{
|
{
|
||||||
const UInt8 * start = data;
|
const UInt8 * start = data;
|
||||||
const UInt8 * end = data + size;
|
const UInt8 * end = data + size;
|
||||||
@ -400,7 +400,7 @@ struct MinHashImpl
|
|||||||
using MaxHeap = Heap<std::less<>>;
|
using MaxHeap = Heap<std::less<>>;
|
||||||
using MinHeap = Heap<std::greater<>>;
|
using MinHeap = Heap<std::greater<>>;
|
||||||
|
|
||||||
static ALWAYS_INLINE inline void ngramHashASCII(
|
static ALWAYS_INLINE void ngramHashASCII(
|
||||||
MinHeap & min_heap,
|
MinHeap & min_heap,
|
||||||
MaxHeap & max_heap,
|
MaxHeap & max_heap,
|
||||||
const UInt8 * data,
|
const UInt8 * data,
|
||||||
@ -429,7 +429,7 @@ struct MinHashImpl
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static ALWAYS_INLINE inline void ngramHashUTF8(
|
static ALWAYS_INLINE void ngramHashUTF8(
|
||||||
MinHeap & min_heap,
|
MinHeap & min_heap,
|
||||||
MaxHeap & max_heap,
|
MaxHeap & max_heap,
|
||||||
const UInt8 * data,
|
const UInt8 * data,
|
||||||
@ -472,7 +472,7 @@ struct MinHashImpl
|
|||||||
// MinHash word shingle hash value calculate function: String ->Tuple(UInt64, UInt64)
|
// MinHash word shingle hash value calculate function: String ->Tuple(UInt64, UInt64)
|
||||||
// for each word shingle, we calculate a hash value, but in fact, we just maintain the
|
// for each word shingle, we calculate a hash value, but in fact, we just maintain the
|
||||||
// K minimum and K maximum hash value
|
// K minimum and K maximum hash value
|
||||||
static ALWAYS_INLINE inline void wordShingleHash(
|
static ALWAYS_INLINE void wordShingleHash(
|
||||||
MinHeap & min_heap,
|
MinHeap & min_heap,
|
||||||
MaxHeap & max_heap,
|
MaxHeap & max_heap,
|
||||||
const UInt8 * data,
|
const UInt8 * data,
|
||||||
|
@ -85,7 +85,7 @@ struct NgramDistanceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <size_t Offset, class Container, size_t... I>
|
template <size_t Offset, class Container, size_t... I>
|
||||||
static ALWAYS_INLINE inline void unrollLowering(Container & cont, const std::index_sequence<I...> &)
|
static ALWAYS_INLINE void unrollLowering(Container & cont, const std::index_sequence<I...> &)
|
||||||
{
|
{
|
||||||
((cont[Offset + I] = std::tolower(cont[Offset + I])), ...);
|
((cont[Offset + I] = std::tolower(cont[Offset + I])), ...);
|
||||||
}
|
}
|
||||||
@ -195,7 +195,7 @@ struct NgramDistanceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <bool save_ngrams>
|
template <bool save_ngrams>
|
||||||
static ALWAYS_INLINE inline size_t calculateNeedleStats(
|
static ALWAYS_INLINE size_t calculateNeedleStats(
|
||||||
const char * data,
|
const char * data,
|
||||||
const size_t size,
|
const size_t size,
|
||||||
NgramCount * ngram_stats,
|
NgramCount * ngram_stats,
|
||||||
@ -228,7 +228,7 @@ struct NgramDistanceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <bool reuse_stats>
|
template <bool reuse_stats>
|
||||||
static ALWAYS_INLINE inline UInt64 calculateHaystackStatsAndMetric(
|
static ALWAYS_INLINE UInt64 calculateHaystackStatsAndMetric(
|
||||||
const char * data,
|
const char * data,
|
||||||
const size_t size,
|
const size_t size,
|
||||||
NgramCount * ngram_stats,
|
NgramCount * ngram_stats,
|
||||||
@ -275,7 +275,7 @@ struct NgramDistanceImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <class Callback, class... Args>
|
template <class Callback, class... Args>
|
||||||
static inline auto dispatchSearcher(Callback callback, Args &&... args)
|
static auto dispatchSearcher(Callback callback, Args &&... args)
|
||||||
{
|
{
|
||||||
if constexpr (!UTF8)
|
if constexpr (!UTF8)
|
||||||
return callback(std::forward<Args>(args)..., readASCIICodePoints, calculateASCIIHash);
|
return callback(std::forward<Args>(args)..., readASCIICodePoints, calculateASCIIHash);
|
||||||
|
@ -97,7 +97,7 @@ template<> \
|
|||||||
template <> \
|
template <> \
|
||||||
struct AddTime<IntervalKind::Kind::INTERVAL_KIND> \
|
struct AddTime<IntervalKind::Kind::INTERVAL_KIND> \
|
||||||
{ \
|
{ \
|
||||||
static inline auto execute(UInt16 d, Int64 delta, const DateLUTImpl & time_zone) \
|
static auto execute(UInt16 d, Int64 delta, const DateLUTImpl & time_zone) \
|
||||||
{ \
|
{ \
|
||||||
return time_zone.add##INTERVAL_KIND##s(ExtendedDayNum(d), delta); \
|
return time_zone.add##INTERVAL_KIND##s(ExtendedDayNum(d), delta); \
|
||||||
} \
|
} \
|
||||||
@ -110,7 +110,7 @@ template<> \
|
|||||||
template <>
|
template <>
|
||||||
struct AddTime<IntervalKind::Kind::Week>
|
struct AddTime<IntervalKind::Kind::Week>
|
||||||
{
|
{
|
||||||
static inline NO_SANITIZE_UNDEFINED ExtendedDayNum execute(UInt16 d, UInt64 delta, const DateLUTImpl &)
|
static NO_SANITIZE_UNDEFINED ExtendedDayNum execute(UInt16 d, UInt64 delta, const DateLUTImpl &)
|
||||||
{
|
{
|
||||||
return ExtendedDayNum(static_cast<Int32>(d + delta * 7));
|
return ExtendedDayNum(static_cast<Int32>(d + delta * 7));
|
||||||
}
|
}
|
||||||
@ -120,7 +120,7 @@ template<> \
|
|||||||
template <> \
|
template <> \
|
||||||
struct AddTime<IntervalKind::Kind::INTERVAL_KIND> \
|
struct AddTime<IntervalKind::Kind::INTERVAL_KIND> \
|
||||||
{ \
|
{ \
|
||||||
static inline NO_SANITIZE_UNDEFINED UInt32 execute(UInt32 t, Int64 delta, const DateLUTImpl &) \
|
static NO_SANITIZE_UNDEFINED UInt32 execute(UInt32 t, Int64 delta, const DateLUTImpl &) \
|
||||||
{ return static_cast<UInt32>(t + delta * (INTERVAL)); } \
|
{ return static_cast<UInt32>(t + delta * (INTERVAL)); } \
|
||||||
};
|
};
|
||||||
ADD_TIME(Day, 86400)
|
ADD_TIME(Day, 86400)
|
||||||
@ -133,7 +133,7 @@ template<> \
|
|||||||
template <> \
|
template <> \
|
||||||
struct AddTime<IntervalKind::Kind::INTERVAL_KIND> \
|
struct AddTime<IntervalKind::Kind::INTERVAL_KIND> \
|
||||||
{ \
|
{ \
|
||||||
static inline NO_SANITIZE_UNDEFINED Int64 execute(Int64 t, UInt64 delta, const UInt32 scale) \
|
static NO_SANITIZE_UNDEFINED Int64 execute(Int64 t, UInt64 delta, const UInt32 scale) \
|
||||||
{ \
|
{ \
|
||||||
if (scale < (DEF_SCALE)) \
|
if (scale < (DEF_SCALE)) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -18,7 +18,7 @@ namespace DB
|
|||||||
*/
|
*/
|
||||||
struct FunctionDetectTonalityImpl
|
struct FunctionDetectTonalityImpl
|
||||||
{
|
{
|
||||||
static ALWAYS_INLINE inline Float32 detectTonality(
|
static ALWAYS_INLINE Float32 detectTonality(
|
||||||
const UInt8 * str,
|
const UInt8 * str,
|
||||||
const size_t str_len,
|
const size_t str_len,
|
||||||
const FrequencyHolder::Map & emotional_dict)
|
const FrequencyHolder::Map & emotional_dict)
|
||||||
|
@ -26,7 +26,7 @@ struct GCDLCMImpl
|
|||||||
static const constexpr bool allow_string_integer = false;
|
static const constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline Result apply(A a, B b)
|
static Result apply(A a, B b)
|
||||||
{
|
{
|
||||||
throwIfDivisionLeadsToFPE(typename NumberTraits::ToInteger<A>::Type(a), typename NumberTraits::ToInteger<B>::Type(b));
|
throwIfDivisionLeadsToFPE(typename NumberTraits::ToInteger<A>::Type(a), typename NumberTraits::ToInteger<B>::Type(b));
|
||||||
throwIfDivisionLeadsToFPE(typename NumberTraits::ToInteger<B>::Type(b), typename NumberTraits::ToInteger<A>::Type(a));
|
throwIfDivisionLeadsToFPE(typename NumberTraits::ToInteger<B>::Type(b), typename NumberTraits::ToInteger<A>::Type(a));
|
||||||
|
@ -20,12 +20,12 @@ namespace ErrorCodes
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
inline constexpr bool is_leap_year(int32_t year)
|
constexpr bool is_leap_year(int32_t year)
|
||||||
{
|
{
|
||||||
return (year % 4 == 0) && ((year % 400 == 0) || (year % 100 != 0));
|
return (year % 4 == 0) && ((year % 400 == 0) || (year % 100 != 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline constexpr uint8_t monthLength(bool is_leap_year, uint8_t month)
|
constexpr uint8_t monthLength(bool is_leap_year, uint8_t month)
|
||||||
{
|
{
|
||||||
switch (month)
|
switch (month)
|
||||||
{
|
{
|
||||||
@ -49,7 +49,7 @@ namespace
|
|||||||
/** Integer division truncated toward negative infinity.
|
/** Integer division truncated toward negative infinity.
|
||||||
*/
|
*/
|
||||||
template <typename I, typename J>
|
template <typename I, typename J>
|
||||||
inline constexpr I div(I x, J y)
|
constexpr I div(I x, J y)
|
||||||
{
|
{
|
||||||
const auto y_cast = static_cast<I>(y);
|
const auto y_cast = static_cast<I>(y);
|
||||||
if (x > 0 && y_cast < 0)
|
if (x > 0 && y_cast < 0)
|
||||||
@ -63,7 +63,7 @@ namespace
|
|||||||
/** Integer modulus, satisfying div(x, y)*y + mod(x, y) == x.
|
/** Integer modulus, satisfying div(x, y)*y + mod(x, y) == x.
|
||||||
*/
|
*/
|
||||||
template <typename I, typename J>
|
template <typename I, typename J>
|
||||||
inline constexpr I mod(I x, J y)
|
constexpr I mod(I x, J y)
|
||||||
{
|
{
|
||||||
const auto y_cast = static_cast<I>(y);
|
const auto y_cast = static_cast<I>(y);
|
||||||
const auto r = x % y_cast;
|
const auto r = x % y_cast;
|
||||||
@ -76,7 +76,7 @@ namespace
|
|||||||
/** Like std::min(), but the type of operands may differ.
|
/** Like std::min(), but the type of operands may differ.
|
||||||
*/
|
*/
|
||||||
template <typename I, typename J>
|
template <typename I, typename J>
|
||||||
inline constexpr I min(I x, J y)
|
constexpr I min(I x, J y)
|
||||||
{
|
{
|
||||||
const auto y_cast = static_cast<I>(y);
|
const auto y_cast = static_cast<I>(y);
|
||||||
return x < y_cast ? x : y_cast;
|
return x < y_cast ? x : y_cast;
|
||||||
|
@ -124,7 +124,7 @@ public:
|
|||||||
|
|
||||||
bool hasEmptyBound() const { return has_empty_bound; }
|
bool hasEmptyBound() const { return has_empty_bound; }
|
||||||
|
|
||||||
inline bool ALWAYS_INLINE contains(CoordinateType x, CoordinateType y) const
|
bool ALWAYS_INLINE contains(CoordinateType x, CoordinateType y) const
|
||||||
{
|
{
|
||||||
Point point(x, y);
|
Point point(x, y);
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
template <typename ... Args>
|
template <typename ... Args>
|
||||||
inline auto NO_SANITIZE_UNDEFINED execute(const DateTime64 & t, Args && ... args) const
|
auto NO_SANITIZE_UNDEFINED execute(const DateTime64 & t, Args && ... args) const
|
||||||
{
|
{
|
||||||
/// Type conversion from float to integer may be required.
|
/// Type conversion from float to integer may be required.
|
||||||
/// We are Ok with implementation specific result for out of range and denormals conversion.
|
/// We are Ok with implementation specific result for out of range and denormals conversion.
|
||||||
@ -90,14 +90,14 @@ public:
|
|||||||
|
|
||||||
template <typename T, typename... Args>
|
template <typename T, typename... Args>
|
||||||
requires(!std::same_as<T, DateTime64>)
|
requires(!std::same_as<T, DateTime64>)
|
||||||
inline auto execute(const T & t, Args &&... args) const
|
auto execute(const T & t, Args &&... args) const
|
||||||
{
|
{
|
||||||
return wrapped_transform.execute(t, std::forward<Args>(args)...);
|
return wrapped_transform.execute(t, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename ... Args>
|
template <typename ... Args>
|
||||||
inline auto NO_SANITIZE_UNDEFINED executeExtendedResult(const DateTime64 & t, Args && ... args) const
|
auto NO_SANITIZE_UNDEFINED executeExtendedResult(const DateTime64 & t, Args && ... args) const
|
||||||
{
|
{
|
||||||
/// Type conversion from float to integer may be required.
|
/// Type conversion from float to integer may be required.
|
||||||
/// We are Ok with implementation specific result for out of range and denormals conversion.
|
/// We are Ok with implementation specific result for out of range and denormals conversion.
|
||||||
@ -131,7 +131,7 @@ public:
|
|||||||
|
|
||||||
template <typename T, typename ... Args>
|
template <typename T, typename ... Args>
|
||||||
requires (!std::same_as<T, DateTime64>)
|
requires (!std::same_as<T, DateTime64>)
|
||||||
inline auto executeExtendedResult(const T & t, Args && ... args) const
|
auto executeExtendedResult(const T & t, Args && ... args) const
|
||||||
{
|
{
|
||||||
return wrapped_transform.executeExtendedResult(t, std::forward<Args>(args)...);
|
return wrapped_transform.executeExtendedResult(t, std::forward<Args>(args)...);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ struct AbsImpl
|
|||||||
using ResultType = std::conditional_t<is_decimal<A>, A, typename NumberTraits::ResultOfAbs<A>::Type>;
|
using ResultType = std::conditional_t<is_decimal<A>, A, typename NumberTraits::ResultOfAbs<A>::Type>;
|
||||||
static constexpr bool allow_string_or_fixed_string = false;
|
static constexpr bool allow_string_or_fixed_string = false;
|
||||||
|
|
||||||
static inline NO_SANITIZE_UNDEFINED ResultType apply(A a)
|
static NO_SANITIZE_UNDEFINED ResultType apply(A a)
|
||||||
{
|
{
|
||||||
if constexpr (is_decimal<A>)
|
if constexpr (is_decimal<A>)
|
||||||
return a < A(0) ? A(-a) : a;
|
return a < A(0) ? A(-a) : a;
|
||||||
|
@ -322,7 +322,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <bool IsConst>
|
template <bool IsConst>
|
||||||
static inline void invokeCheckNullMaps(
|
static void invokeCheckNullMaps(
|
||||||
const ColumnString::Chars & data, const ColumnArray::Offsets & offsets,
|
const ColumnString::Chars & data, const ColumnArray::Offsets & offsets,
|
||||||
const ColumnString::Offsets & str_offsets, const ColumnString::Chars & values,
|
const ColumnString::Offsets & str_offsets, const ColumnString::Chars & values,
|
||||||
OffsetT<IsConst> item_offsets,
|
OffsetT<IsConst> item_offsets,
|
||||||
@ -339,7 +339,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static inline void process(
|
static void process(
|
||||||
const ColumnString::Chars & data, const ColumnArray::Offsets & offsets,
|
const ColumnString::Chars & data, const ColumnArray::Offsets & offsets,
|
||||||
const ColumnString::Offsets & string_offsets, const ColumnString::Chars & item_values,
|
const ColumnString::Offsets & string_offsets, const ColumnString::Chars & item_values,
|
||||||
Offset item_offsets, PaddedPODArray<ResultType> & result,
|
Offset item_offsets, PaddedPODArray<ResultType> & result,
|
||||||
@ -348,7 +348,7 @@ public:
|
|||||||
invokeCheckNullMaps<true>(data, offsets, string_offsets, item_values, item_offsets, result, data_map, item_map);
|
invokeCheckNullMaps<true>(data, offsets, string_offsets, item_values, item_offsets, result, data_map, item_map);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void process(
|
static void process(
|
||||||
const ColumnString::Chars & data, const ColumnArray::Offsets & offsets,
|
const ColumnString::Chars & data, const ColumnArray::Offsets & offsets,
|
||||||
const ColumnString::Offsets & string_offsets, const ColumnString::Chars & item_values,
|
const ColumnString::Offsets & string_offsets, const ColumnString::Chars & item_values,
|
||||||
const ColumnString::Offsets & item_offsets, PaddedPODArray<ResultType> & result,
|
const ColumnString::Offsets & item_offsets, PaddedPODArray<ResultType> & result,
|
||||||
@ -467,10 +467,10 @@ private:
|
|||||||
NullMaps maps;
|
NullMaps maps;
|
||||||
ResultColumnPtr result { ResultColumnType::create() };
|
ResultColumnPtr result { ResultColumnType::create() };
|
||||||
|
|
||||||
inline void moveResult() { result_column = std::move(result); }
|
void moveResult() { result_column = std::move(result); }
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool allowArguments(const DataTypePtr & inner_type, const DataTypePtr & arg)
|
static bool allowArguments(const DataTypePtr & inner_type, const DataTypePtr & arg)
|
||||||
{
|
{
|
||||||
auto inner_type_decayed = removeNullable(removeLowCardinality(inner_type));
|
auto inner_type_decayed = removeNullable(removeLowCardinality(inner_type));
|
||||||
auto arg_decayed = removeNullable(removeLowCardinality(arg));
|
auto arg_decayed = removeNullable(removeLowCardinality(arg));
|
||||||
@ -633,7 +633,7 @@ private:
|
|||||||
* (s1, s1, s2, ...), (s2, s1, s2, ...), (s3, s1, s2, ...)
|
* (s1, s1, s2, ...), (s2, s1, s2, ...), (s3, s1, s2, ...)
|
||||||
*/
|
*/
|
||||||
template <typename... Integral>
|
template <typename... Integral>
|
||||||
static inline ColumnPtr executeIntegral(const ColumnsWithTypeAndName & arguments)
|
static ColumnPtr executeIntegral(const ColumnsWithTypeAndName & arguments)
|
||||||
{
|
{
|
||||||
const ColumnArray * const left = checkAndGetColumn<ColumnArray>(arguments[0].column.get());
|
const ColumnArray * const left = checkAndGetColumn<ColumnArray>(arguments[0].column.get());
|
||||||
|
|
||||||
@ -658,14 +658,14 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename... Integral>
|
template <typename... Integral>
|
||||||
static inline bool executeIntegral(ExecutionData& data)
|
static bool executeIntegral(ExecutionData& data)
|
||||||
{
|
{
|
||||||
return (executeIntegralExpanded<Integral, Integral...>(data) || ...);
|
return (executeIntegralExpanded<Integral, Integral...>(data) || ...);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Invoke executeIntegralImpl with such parameters: (A, other1), (A, other2), ...
|
/// Invoke executeIntegralImpl with such parameters: (A, other1), (A, other2), ...
|
||||||
template <typename A, typename... Other>
|
template <typename A, typename... Other>
|
||||||
static inline bool executeIntegralExpanded(ExecutionData& data)
|
static bool executeIntegralExpanded(ExecutionData& data)
|
||||||
{
|
{
|
||||||
return (executeIntegralImpl<A, Other>(data) || ...);
|
return (executeIntegralImpl<A, Other>(data) || ...);
|
||||||
}
|
}
|
||||||
|
@ -25,19 +25,19 @@ struct L1Norm
|
|||||||
struct ConstParams {};
|
struct ConstParams {};
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType accumulate(ResultType result, ResultType value, const ConstParams &)
|
static ResultType accumulate(ResultType result, ResultType value, const ConstParams &)
|
||||||
{
|
{
|
||||||
return result + fabs(value);
|
return result + fabs(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType combine(ResultType result, ResultType other_result, const ConstParams &)
|
static ResultType combine(ResultType result, ResultType other_result, const ConstParams &)
|
||||||
{
|
{
|
||||||
return result + other_result;
|
return result + other_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType finalize(ResultType result, const ConstParams &)
|
static ResultType finalize(ResultType result, const ConstParams &)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -50,19 +50,19 @@ struct L2Norm
|
|||||||
struct ConstParams {};
|
struct ConstParams {};
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType accumulate(ResultType result, ResultType value, const ConstParams &)
|
static ResultType accumulate(ResultType result, ResultType value, const ConstParams &)
|
||||||
{
|
{
|
||||||
return result + value * value;
|
return result + value * value;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType combine(ResultType result, ResultType other_result, const ConstParams &)
|
static ResultType combine(ResultType result, ResultType other_result, const ConstParams &)
|
||||||
{
|
{
|
||||||
return result + other_result;
|
return result + other_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType finalize(ResultType result, const ConstParams &)
|
static ResultType finalize(ResultType result, const ConstParams &)
|
||||||
{
|
{
|
||||||
return sqrt(result);
|
return sqrt(result);
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ struct L2SquaredNorm : L2Norm
|
|||||||
static constexpr auto name = "L2Squared";
|
static constexpr auto name = "L2Squared";
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType finalize(ResultType result, const ConstParams &)
|
static ResultType finalize(ResultType result, const ConstParams &)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -91,19 +91,19 @@ struct LpNorm
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType accumulate(ResultType result, ResultType value, const ConstParams & params)
|
static ResultType accumulate(ResultType result, ResultType value, const ConstParams & params)
|
||||||
{
|
{
|
||||||
return result + static_cast<ResultType>(std::pow(fabs(value), params.power));
|
return result + static_cast<ResultType>(std::pow(fabs(value), params.power));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType combine(ResultType result, ResultType other_result, const ConstParams &)
|
static ResultType combine(ResultType result, ResultType other_result, const ConstParams &)
|
||||||
{
|
{
|
||||||
return result + other_result;
|
return result + other_result;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType finalize(ResultType result, const ConstParams & params)
|
static ResultType finalize(ResultType result, const ConstParams & params)
|
||||||
{
|
{
|
||||||
return static_cast<ResultType>(std::pow(result, params.inverted_power));
|
return static_cast<ResultType>(std::pow(result, params.inverted_power));
|
||||||
}
|
}
|
||||||
@ -116,19 +116,19 @@ struct LinfNorm
|
|||||||
struct ConstParams {};
|
struct ConstParams {};
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType accumulate(ResultType result, ResultType value, const ConstParams &)
|
static ResultType accumulate(ResultType result, ResultType value, const ConstParams &)
|
||||||
{
|
{
|
||||||
return fmax(result, fabs(value));
|
return fmax(result, fabs(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType combine(ResultType result, ResultType other_result, const ConstParams &)
|
static ResultType combine(ResultType result, ResultType other_result, const ConstParams &)
|
||||||
{
|
{
|
||||||
return fmax(result, other_result);
|
return fmax(result, other_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename ResultType>
|
template <typename ResultType>
|
||||||
inline static ResultType finalize(ResultType result, const ConstParams &)
|
static ResultType finalize(ResultType result, const ConstParams &)
|
||||||
{
|
{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ struct BitAndImpl
|
|||||||
static constexpr bool allow_string_integer = false;
|
static constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline Result apply(A a, B b)
|
static Result apply(A a, B b)
|
||||||
{
|
{
|
||||||
return static_cast<Result>(a) & static_cast<Result>(b);
|
return static_cast<Result>(a) & static_cast<Result>(b);
|
||||||
}
|
}
|
||||||
@ -28,7 +28,7 @@ struct BitAndImpl
|
|||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static constexpr bool compilable = true;
|
static constexpr bool compilable = true;
|
||||||
|
|
||||||
static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
||||||
{
|
{
|
||||||
if (!left->getType()->isIntegerTy())
|
if (!left->getType()->isIntegerTy())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitAndImpl expected an integral type");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitAndImpl expected an integral type");
|
||||||
|
@ -25,7 +25,7 @@ struct BitBoolMaskAndImpl
|
|||||||
static const constexpr bool allow_string_integer = false;
|
static const constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline Result apply([[maybe_unused]] A left, [[maybe_unused]] B right)
|
static Result apply([[maybe_unused]] A left, [[maybe_unused]] B right)
|
||||||
{
|
{
|
||||||
// Should be a logical error, but this function is callable from SQL.
|
// Should be a logical error, but this function is callable from SQL.
|
||||||
// Need to investigate this.
|
// Need to investigate this.
|
||||||
|
@ -25,7 +25,7 @@ struct BitBoolMaskOrImpl
|
|||||||
static const constexpr bool allow_string_integer = false;
|
static const constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline Result apply([[maybe_unused]] A left, [[maybe_unused]] B right)
|
static Result apply([[maybe_unused]] A left, [[maybe_unused]] B right)
|
||||||
{
|
{
|
||||||
if constexpr (!std::is_same_v<A, ResultType> || !std::is_same_v<B, ResultType>)
|
if constexpr (!std::is_same_v<A, ResultType> || !std::is_same_v<B, ResultType>)
|
||||||
// Should be a logical error, but this function is callable from SQL.
|
// Should be a logical error, but this function is callable from SQL.
|
||||||
|
@ -13,7 +13,7 @@ struct BitCountImpl
|
|||||||
using ResultType = std::conditional_t<(sizeof(A) * 8 >= 256), UInt16, UInt8>;
|
using ResultType = std::conditional_t<(sizeof(A) * 8 >= 256), UInt16, UInt8>;
|
||||||
static constexpr bool allow_string_or_fixed_string = true;
|
static constexpr bool allow_string_or_fixed_string = true;
|
||||||
|
|
||||||
static inline ResultType apply(A a)
|
static ResultType apply(A a)
|
||||||
{
|
{
|
||||||
/// We count bits in the value representation in memory. For example, we support floats.
|
/// We count bits in the value representation in memory. For example, we support floats.
|
||||||
/// We need to avoid sign-extension when converting signed numbers to larger type. So, uint8_t(-1) has 8 bits.
|
/// We need to avoid sign-extension when converting signed numbers to larger type. So, uint8_t(-1) has 8 bits.
|
||||||
|
@ -19,7 +19,7 @@ struct BitHammingDistanceImpl
|
|||||||
static constexpr bool allow_string_integer = false;
|
static constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a, B b)
|
static NO_SANITIZE_UNDEFINED Result apply(A a, B b)
|
||||||
{
|
{
|
||||||
/// Note: it's unspecified if signed integers should be promoted with sign-extension or with zero-fill.
|
/// Note: it's unspecified if signed integers should be promoted with sign-extension or with zero-fill.
|
||||||
/// This behavior can change in the future.
|
/// This behavior can change in the future.
|
||||||
|
@ -19,7 +19,7 @@ struct BitNotImpl
|
|||||||
using ResultType = typename NumberTraits::ResultOfBitNot<A>::Type;
|
using ResultType = typename NumberTraits::ResultOfBitNot<A>::Type;
|
||||||
static constexpr bool allow_string_or_fixed_string = true;
|
static constexpr bool allow_string_or_fixed_string = true;
|
||||||
|
|
||||||
static inline ResultType NO_SANITIZE_UNDEFINED apply(A a)
|
static ResultType NO_SANITIZE_UNDEFINED apply(A a)
|
||||||
{
|
{
|
||||||
return ~static_cast<ResultType>(a);
|
return ~static_cast<ResultType>(a);
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ struct BitNotImpl
|
|||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static constexpr bool compilable = true;
|
static constexpr bool compilable = true;
|
||||||
|
|
||||||
static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * arg, bool)
|
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * arg, bool)
|
||||||
{
|
{
|
||||||
if (!arg->getType()->isIntegerTy())
|
if (!arg->getType()->isIntegerTy())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitNotImpl expected an integral type");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitNotImpl expected an integral type");
|
||||||
|
@ -19,7 +19,7 @@ struct BitOrImpl
|
|||||||
static constexpr bool allow_string_integer = false;
|
static constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline Result apply(A a, B b)
|
static Result apply(A a, B b)
|
||||||
{
|
{
|
||||||
return static_cast<Result>(a) | static_cast<Result>(b);
|
return static_cast<Result>(a) | static_cast<Result>(b);
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ struct BitOrImpl
|
|||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static constexpr bool compilable = true;
|
static constexpr bool compilable = true;
|
||||||
|
|
||||||
static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
||||||
{
|
{
|
||||||
if (!left->getType()->isIntegerTy())
|
if (!left->getType()->isIntegerTy())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitOrImpl expected an integral type");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitOrImpl expected an integral type");
|
||||||
|
@ -20,7 +20,7 @@ struct BitRotateLeftImpl
|
|||||||
static const constexpr bool allow_string_integer = false;
|
static const constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
static NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<A> || is_big_int_v<B>)
|
if constexpr (is_big_int_v<A> || is_big_int_v<B>)
|
||||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Bit rotate is not implemented for big integers");
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Bit rotate is not implemented for big integers");
|
||||||
@ -32,7 +32,7 @@ struct BitRotateLeftImpl
|
|||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static constexpr bool compilable = true;
|
static constexpr bool compilable = true;
|
||||||
|
|
||||||
static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
||||||
{
|
{
|
||||||
if (!left->getType()->isIntegerTy())
|
if (!left->getType()->isIntegerTy())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitRotateLeftImpl expected an integral type");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitRotateLeftImpl expected an integral type");
|
||||||
|
@ -20,7 +20,7 @@ struct BitRotateRightImpl
|
|||||||
static const constexpr bool allow_string_integer = false;
|
static const constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
static NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<A> || is_big_int_v<B>)
|
if constexpr (is_big_int_v<A> || is_big_int_v<B>)
|
||||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Bit rotate is not implemented for big integers");
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Bit rotate is not implemented for big integers");
|
||||||
@ -32,7 +32,7 @@ struct BitRotateRightImpl
|
|||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static constexpr bool compilable = true;
|
static constexpr bool compilable = true;
|
||||||
|
|
||||||
static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
||||||
{
|
{
|
||||||
if (!left->getType()->isIntegerTy())
|
if (!left->getType()->isIntegerTy())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitRotateRightImpl expected an integral type");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitRotateRightImpl expected an integral type");
|
||||||
|
@ -20,7 +20,7 @@ struct BitShiftLeftImpl
|
|||||||
static const constexpr bool allow_string_integer = true;
|
static const constexpr bool allow_string_integer = true;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
static NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<B>)
|
if constexpr (is_big_int_v<B>)
|
||||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "BitShiftLeft is not implemented for big integers as second argument");
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "BitShiftLeft is not implemented for big integers as second argument");
|
||||||
@ -145,7 +145,7 @@ struct BitShiftLeftImpl
|
|||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static constexpr bool compilable = true;
|
static constexpr bool compilable = true;
|
||||||
|
|
||||||
static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
||||||
{
|
{
|
||||||
if (!left->getType()->isIntegerTy())
|
if (!left->getType()->isIntegerTy())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitShiftLeftImpl expected an integral type");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitShiftLeftImpl expected an integral type");
|
||||||
|
@ -21,7 +21,7 @@ struct BitShiftRightImpl
|
|||||||
static const constexpr bool allow_string_integer = true;
|
static const constexpr bool allow_string_integer = true;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
static NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<B>)
|
if constexpr (is_big_int_v<B>)
|
||||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "BitShiftRight is not implemented for big integers as second argument");
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "BitShiftRight is not implemented for big integers as second argument");
|
||||||
@ -31,7 +31,7 @@ struct BitShiftRightImpl
|
|||||||
return static_cast<Result>(a) >> static_cast<Result>(b);
|
return static_cast<Result>(a) >> static_cast<Result>(b);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline NO_SANITIZE_UNDEFINED void bitShiftRightForBytes(const UInt8 * op_pointer, const UInt8 * begin, UInt8 * out, const size_t shift_right_bits)
|
static NO_SANITIZE_UNDEFINED void bitShiftRightForBytes(const UInt8 * op_pointer, const UInt8 * begin, UInt8 * out, const size_t shift_right_bits)
|
||||||
{
|
{
|
||||||
while (op_pointer > begin)
|
while (op_pointer > begin)
|
||||||
{
|
{
|
||||||
@ -123,7 +123,7 @@ struct BitShiftRightImpl
|
|||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static constexpr bool compilable = true;
|
static constexpr bool compilable = true;
|
||||||
|
|
||||||
static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool is_signed)
|
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool is_signed)
|
||||||
{
|
{
|
||||||
if (!left->getType()->isIntegerTy())
|
if (!left->getType()->isIntegerTy())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitShiftRightImpl expected an integral type");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitShiftRightImpl expected an integral type");
|
||||||
|
@ -21,7 +21,7 @@ struct BitSwapLastTwoImpl
|
|||||||
using ResultType = UInt8;
|
using ResultType = UInt8;
|
||||||
static constexpr const bool allow_string_or_fixed_string = false;
|
static constexpr const bool allow_string_or_fixed_string = false;
|
||||||
|
|
||||||
static inline ResultType NO_SANITIZE_UNDEFINED apply([[maybe_unused]] A a)
|
static ResultType NO_SANITIZE_UNDEFINED apply([[maybe_unused]] A a)
|
||||||
{
|
{
|
||||||
if constexpr (!std::is_same_v<A, ResultType>)
|
if constexpr (!std::is_same_v<A, ResultType>)
|
||||||
// Should be a logical error, but this function is callable from SQL.
|
// Should be a logical error, but this function is callable from SQL.
|
||||||
@ -35,7 +35,7 @@ struct BitSwapLastTwoImpl
|
|||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static constexpr bool compilable = true;
|
static constexpr bool compilable = true;
|
||||||
|
|
||||||
static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * arg, bool)
|
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * arg, bool)
|
||||||
{
|
{
|
||||||
if (!arg->getType()->isIntegerTy())
|
if (!arg->getType()->isIntegerTy())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "__bitSwapLastTwo expected an integral type");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "__bitSwapLastTwo expected an integral type");
|
||||||
|
@ -21,7 +21,7 @@ struct BitTestImpl
|
|||||||
static const constexpr bool allow_string_integer = false;
|
static const constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
NO_SANITIZE_UNDEFINED static inline Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
NO_SANITIZE_UNDEFINED static Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
if constexpr (is_big_int_v<A> || is_big_int_v<B>)
|
if constexpr (is_big_int_v<A> || is_big_int_v<B>)
|
||||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "bitTest is not implemented for big integers as second argument");
|
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "bitTest is not implemented for big integers as second argument");
|
||||||
|
@ -9,7 +9,7 @@ namespace
|
|||||||
struct BitTestAllImpl
|
struct BitTestAllImpl
|
||||||
{
|
{
|
||||||
template <typename A, typename B>
|
template <typename A, typename B>
|
||||||
static inline UInt8 apply(A a, B b) { return (a & b) == b; }
|
static UInt8 apply(A a, B b) { return (a & b) == b; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NameBitTestAll { static constexpr auto name = "bitTestAll"; };
|
struct NameBitTestAll { static constexpr auto name = "bitTestAll"; };
|
||||||
|
@ -9,7 +9,7 @@ namespace
|
|||||||
struct BitTestAnyImpl
|
struct BitTestAnyImpl
|
||||||
{
|
{
|
||||||
template <typename A, typename B>
|
template <typename A, typename B>
|
||||||
static inline UInt8 apply(A a, B b) { return (a & b) != 0; }
|
static UInt8 apply(A a, B b) { return (a & b) != 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct NameBitTestAny { static constexpr auto name = "bitTestAny"; };
|
struct NameBitTestAny { static constexpr auto name = "bitTestAny"; };
|
||||||
|
@ -21,7 +21,7 @@ struct BitWrapperFuncImpl
|
|||||||
using ResultType = UInt8;
|
using ResultType = UInt8;
|
||||||
static constexpr const bool allow_string_or_fixed_string = false;
|
static constexpr const bool allow_string_or_fixed_string = false;
|
||||||
|
|
||||||
static inline ResultType NO_SANITIZE_UNDEFINED apply(A a [[maybe_unused]])
|
static ResultType NO_SANITIZE_UNDEFINED apply(A a [[maybe_unused]])
|
||||||
{
|
{
|
||||||
// Should be a logical error, but this function is callable from SQL.
|
// Should be a logical error, but this function is callable from SQL.
|
||||||
// Need to investigate this.
|
// Need to investigate this.
|
||||||
|
@ -19,7 +19,7 @@ struct BitXorImpl
|
|||||||
static const constexpr bool allow_string_integer = false;
|
static const constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline Result apply(A a, B b)
|
static Result apply(A a, B b)
|
||||||
{
|
{
|
||||||
return static_cast<Result>(a) ^ static_cast<Result>(b);
|
return static_cast<Result>(a) ^ static_cast<Result>(b);
|
||||||
}
|
}
|
||||||
@ -27,7 +27,7 @@ struct BitXorImpl
|
|||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static constexpr bool compilable = true;
|
static constexpr bool compilable = true;
|
||||||
|
|
||||||
static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
||||||
{
|
{
|
||||||
if (!left->getType()->isIntegerTy())
|
if (!left->getType()->isIntegerTy())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitXorImpl expected an integral type");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "BitXorImpl expected an integral type");
|
||||||
|
@ -214,7 +214,7 @@ private:
|
|||||||
template <typename Time>
|
template <typename Time>
|
||||||
struct QuarterWriter
|
struct QuarterWriter
|
||||||
{
|
{
|
||||||
static inline void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
static void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
||||||
{
|
{
|
||||||
writeText(ToQuarterImpl::execute(source, timezone), buffer);
|
writeText(ToQuarterImpl::execute(source, timezone), buffer);
|
||||||
}
|
}
|
||||||
@ -223,7 +223,7 @@ private:
|
|||||||
template <typename Time>
|
template <typename Time>
|
||||||
struct MonthWriter
|
struct MonthWriter
|
||||||
{
|
{
|
||||||
static inline void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
static void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
||||||
{
|
{
|
||||||
const auto month = ToMonthImpl::execute(source, timezone);
|
const auto month = ToMonthImpl::execute(source, timezone);
|
||||||
static constexpr std::string_view month_names[] =
|
static constexpr std::string_view month_names[] =
|
||||||
@ -249,7 +249,7 @@ private:
|
|||||||
template <typename Time>
|
template <typename Time>
|
||||||
struct WeekWriter
|
struct WeekWriter
|
||||||
{
|
{
|
||||||
static inline void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
static void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
||||||
{
|
{
|
||||||
writeText(ToISOWeekImpl::execute(source, timezone), buffer);
|
writeText(ToISOWeekImpl::execute(source, timezone), buffer);
|
||||||
}
|
}
|
||||||
@ -258,7 +258,7 @@ private:
|
|||||||
template <typename Time>
|
template <typename Time>
|
||||||
struct DayOfYearWriter
|
struct DayOfYearWriter
|
||||||
{
|
{
|
||||||
static inline void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
static void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
||||||
{
|
{
|
||||||
writeText(ToDayOfYearImpl::execute(source, timezone), buffer);
|
writeText(ToDayOfYearImpl::execute(source, timezone), buffer);
|
||||||
}
|
}
|
||||||
@ -267,7 +267,7 @@ private:
|
|||||||
template <typename Time>
|
template <typename Time>
|
||||||
struct DayWriter
|
struct DayWriter
|
||||||
{
|
{
|
||||||
static inline void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
static void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
||||||
{
|
{
|
||||||
writeText(ToDayOfMonthImpl::execute(source, timezone), buffer);
|
writeText(ToDayOfMonthImpl::execute(source, timezone), buffer);
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ private:
|
|||||||
template <typename Time>
|
template <typename Time>
|
||||||
struct WeekDayWriter
|
struct WeekDayWriter
|
||||||
{
|
{
|
||||||
static inline void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
static void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
||||||
{
|
{
|
||||||
const auto day = ToDayOfWeekImpl::execute(source, 0, timezone);
|
const auto day = ToDayOfWeekImpl::execute(source, 0, timezone);
|
||||||
static constexpr std::string_view day_names[] =
|
static constexpr std::string_view day_names[] =
|
||||||
@ -297,7 +297,7 @@ private:
|
|||||||
template <typename Time>
|
template <typename Time>
|
||||||
struct HourWriter
|
struct HourWriter
|
||||||
{
|
{
|
||||||
static inline void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
static void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
||||||
{
|
{
|
||||||
writeText(ToHourImpl::execute(source, timezone), buffer);
|
writeText(ToHourImpl::execute(source, timezone), buffer);
|
||||||
}
|
}
|
||||||
@ -306,7 +306,7 @@ private:
|
|||||||
template <typename Time>
|
template <typename Time>
|
||||||
struct MinuteWriter
|
struct MinuteWriter
|
||||||
{
|
{
|
||||||
static inline void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
static void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
||||||
{
|
{
|
||||||
writeText(ToMinuteImpl::execute(source, timezone), buffer);
|
writeText(ToMinuteImpl::execute(source, timezone), buffer);
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ private:
|
|||||||
template <typename Time>
|
template <typename Time>
|
||||||
struct SecondWriter
|
struct SecondWriter
|
||||||
{
|
{
|
||||||
static inline void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
static void write(WriteBuffer & buffer, Time source, const DateLUTImpl & timezone)
|
||||||
{
|
{
|
||||||
writeText(ToSecondImpl::execute(source, timezone), buffer);
|
writeText(ToSecondImpl::execute(source, timezone), buffer);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ struct DivideFloatingImpl
|
|||||||
static const constexpr bool allow_string_integer = false;
|
static const constexpr bool allow_string_integer = false;
|
||||||
|
|
||||||
template <typename Result = ResultType>
|
template <typename Result = ResultType>
|
||||||
static inline NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
static NO_SANITIZE_UNDEFINED Result apply(A a [[maybe_unused]], B b [[maybe_unused]])
|
||||||
{
|
{
|
||||||
return static_cast<Result>(a) / b;
|
return static_cast<Result>(a) / b;
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ struct DivideFloatingImpl
|
|||||||
#if USE_EMBEDDED_COMPILER
|
#if USE_EMBEDDED_COMPILER
|
||||||
static constexpr bool compilable = true;
|
static constexpr bool compilable = true;
|
||||||
|
|
||||||
static inline llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
static llvm::Value * compile(llvm::IRBuilder<> & b, llvm::Value * left, llvm::Value * right, bool)
|
||||||
{
|
{
|
||||||
if (left->getType()->isIntegerTy())
|
if (left->getType()->isIntegerTy())
|
||||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "DivideFloatingImpl expected a floating-point type");
|
throw Exception(ErrorCodes::LOGICAL_ERROR, "DivideFloatingImpl expected a floating-point type");
|
||||||
|
@ -18,7 +18,7 @@ struct DivideDecimalsImpl
|
|||||||
static constexpr auto name = "divideDecimal";
|
static constexpr auto name = "divideDecimal";
|
||||||
|
|
||||||
template <typename FirstType, typename SecondType>
|
template <typename FirstType, typename SecondType>
|
||||||
static inline Decimal256
|
static Decimal256
|
||||||
execute(FirstType a, SecondType b, UInt16 scale_a, UInt16 scale_b, UInt16 result_scale)
|
execute(FirstType a, SecondType b, UInt16 scale_a, UInt16 scale_b, UInt16 result_scale)
|
||||||
{
|
{
|
||||||
if (b.value == 0)
|
if (b.value == 0)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user