From 5108e070cfe793d01cf7f63cd44ab07c898240c4 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Thu, 14 Nov 2024 03:22:44 +0100 Subject: [PATCH] Remove useless code --- src/Client/ClientBaseHelpers.cpp | 2 - src/Common/FailPoint.cpp | 1 + src/Common/FailPoint.h | 2 + src/Compression/CompressionCodecNone.h | 2 +- .../tests/gtest_compressionCodec.cpp | 1 - src/Formats/EscapingRuleUtils.cpp | 1 - src/Parsers/ParserPartition.cpp | 4 +- src/Parsers/StringRange.h | 71 ------------------- 8 files changed, 6 insertions(+), 78 deletions(-) delete mode 100644 src/Parsers/StringRange.h diff --git a/src/Client/ClientBaseHelpers.cpp b/src/Client/ClientBaseHelpers.cpp index e8e009ec306..7b4651a638f 100644 --- a/src/Client/ClientBaseHelpers.cpp +++ b/src/Client/ClientBaseHelpers.cpp @@ -140,8 +140,6 @@ void highlight(const String & query, std::vector & colors /// We don't do highlighting for foreign dialects, such as PRQL and Kusto. /// Only normal ClickHouse SQL queries are highlighted. - /// Currently we highlight only the first query in the multi-query mode. - ParserQuery parser(end, false, context.getSettingsRef()[Setting::implicit_select]); ASTPtr ast; bool parse_res = false; diff --git a/src/Common/FailPoint.cpp b/src/Common/FailPoint.cpp index 0898bdded83..bc1b604d0e5 100644 --- a/src/Common/FailPoint.cpp +++ b/src/Common/FailPoint.cpp @@ -87,6 +87,7 @@ APPLY_FOR_FAILPOINTS(M, M, M, M) std::unordered_map> FailPointInjection::fail_point_wait_channels; std::mutex FailPointInjection::mu; + class FailPointChannel : private boost::noncopyable { public: diff --git a/src/Common/FailPoint.h b/src/Common/FailPoint.h index 1af13d08553..69aa8d75b5b 100644 --- a/src/Common/FailPoint.h +++ b/src/Common/FailPoint.h @@ -15,6 +15,7 @@ #include + namespace DB { @@ -27,6 +28,7 @@ namespace DB /// 3. in test file, we can use system failpoint enable/disable 'failpoint_name' class FailPointChannel; + class FailPointInjection { public: diff --git a/src/Compression/CompressionCodecNone.h b/src/Compression/CompressionCodecNone.h index 5d6f135b351..0aaa973b55f 100644 --- a/src/Compression/CompressionCodecNone.h +++ b/src/Compression/CompressionCodecNone.h @@ -3,7 +3,7 @@ #include #include #include -#include + namespace DB { diff --git a/src/Compression/tests/gtest_compressionCodec.cpp b/src/Compression/tests/gtest_compressionCodec.cpp index 283ccd95f14..8265ba63fc2 100644 --- a/src/Compression/tests/gtest_compressionCodec.cpp +++ b/src/Compression/tests/gtest_compressionCodec.cpp @@ -7,7 +7,6 @@ #include #include #include -#include #include #include diff --git a/src/Formats/EscapingRuleUtils.cpp b/src/Formats/EscapingRuleUtils.cpp index 67371784712..687814baaa6 100644 --- a/src/Formats/EscapingRuleUtils.cpp +++ b/src/Formats/EscapingRuleUtils.cpp @@ -10,7 +10,6 @@ #include #include #include -#include namespace DB diff --git a/src/Parsers/ParserPartition.cpp b/src/Parsers/ParserPartition.cpp index ab97b3d0e3b..55b0d5a3567 100644 --- a/src/Parsers/ParserPartition.cpp +++ b/src/Parsers/ParserPartition.cpp @@ -5,10 +5,10 @@ #include #include #include -#include #include #include + namespace DB { @@ -61,7 +61,7 @@ bool ParserPartition::parseImpl(Pos & pos, ASTPtr & node, Expected & expected) else fields_count = 0; } - else if (const auto* literal_ast = value->as(); literal_ast) + else if (const auto * literal_ast = value->as(); literal_ast) { if (literal_ast->value.getType() == Field::Types::Tuple) { diff --git a/src/Parsers/StringRange.h b/src/Parsers/StringRange.h deleted file mode 100644 index 3c5959fd0a3..00000000000 --- a/src/Parsers/StringRange.h +++ /dev/null @@ -1,71 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - - -namespace DB -{ - -struct StringRange -{ - const char * first = nullptr; - const char * second = nullptr; - - StringRange() = default; - StringRange(const char * begin, const char * end) : first(begin), second(end) {} - explicit StringRange(TokenIterator token) : first(token->begin), second(token->end) {} - - StringRange(TokenIterator token_begin, TokenIterator token_end) - { - /// Empty range. - if (token_begin == token_end) - { - first = token_begin->begin; - second = token_begin->begin; - return; - } - - TokenIterator token_last = token_end; - --token_last; - - first = token_begin->begin; - second = token_last->end; - } -}; - -using StringPtr = std::shared_ptr; - - -inline String toString(const StringRange & range) -{ - return range.first ? String(range.first, range.second) : String(); -} - -/// Hashes only the values of pointers in StringRange. Is used with StringRangePointersEqualTo comparator. -struct StringRangePointersHash -{ - UInt64 operator()(const StringRange & range) const - { - SipHash hash; - hash.update(range.first); - hash.update(range.second); - return hash.get64(); - } -}; - -/// Ranges are equal only when they point to the same memory region. -/// It may be used when it's enough to compare substrings by their position in the same string. -struct StringRangePointersEqualTo -{ - constexpr bool operator()(const StringRange &lhs, const StringRange &rhs) const - { - return std::tie(lhs.first, lhs.second) == std::tie(rhs.first, rhs.second); - } -}; - -} -