Merge pull request #71900 from ClickHouse/remove-trash-2

Remove useless code
This commit is contained in:
Alexey Milovidov 2024-11-14 17:15:59 +01:00 committed by GitHub
commit 903e403b06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 6 additions and 78 deletions

View File

@ -140,8 +140,6 @@ void highlight(const String & query, std::vector<replxx::Replxx::Color> & 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;

View File

@ -87,6 +87,7 @@ APPLY_FOR_FAILPOINTS(M, M, M, M)
std::unordered_map<String, std::shared_ptr<FailPointChannel>> FailPointInjection::fail_point_wait_channels;
std::mutex FailPointInjection::mu;
class FailPointChannel : private boost::noncopyable
{
public:

View File

@ -15,6 +15,7 @@
#include <unordered_map>
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:

View File

@ -3,7 +3,7 @@
#include <IO/WriteBuffer.h>
#include <Compression/ICompressionCodec.h>
#include <IO/BufferWithOwnMemory.h>
#include <Parsers/StringRange.h>
namespace DB
{

View File

@ -7,7 +7,6 @@
#include <Parsers/ExpressionElementParsers.h>
#include <Parsers/IParser.h>
#include <Parsers/TokenIterator.h>
#include <base/types.h>
#include <Common/PODArray.h>
#include <Common/Stopwatch.h>

View File

@ -10,7 +10,6 @@
#include <IO/WriteHelpers.h>
#include <IO/ReadBufferFromString.h>
#include <IO/parseDateTimeBestEffort.h>
#include <Parsers/TokenIterator.h>
namespace DB

View File

@ -5,10 +5,10 @@
#include <Parsers/ASTPartition.h>
#include <Parsers/ASTLiteral.h>
#include <Parsers/ASTFunction.h>
#include <Parsers/ASTIdentifier.h>
#include <Common/typeid_cast.h>
#include <Parsers/ASTQueryParameter.h>
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<ASTLiteral>(); literal_ast)
else if (const auto * literal_ast = value->as<ASTLiteral>(); literal_ast)
{
if (literal_ast->value.getType() == Field::Types::Tuple)
{

View File

@ -1,71 +0,0 @@
#pragma once
#include <base/types.h>
#include <Parsers/TokenIterator.h>
#include <map>
#include <memory>
#include <Common/SipHash.h>
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<String>;
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);
}
};
}