mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-21 09:10:48 +00:00
clang-tidy, part 17
This commit is contained in:
parent
d1025b2dc7
commit
c079a1e15c
@ -584,10 +584,10 @@ TEST_P(CodecTestCompatibility, Decoding)
|
||||
ASSERT_TRUE(EqualByteContainers(expected.data_type->getSizeOfValueInMemory(), expected.serialized_data, decoded));
|
||||
}
|
||||
|
||||
class CodecTest_Performance : public ::testing::TestWithParam<std::tuple<Codec, CodecTestSequence>>
|
||||
class CodecTestPerformance : public ::testing::TestWithParam<std::tuple<Codec, CodecTestSequence>>
|
||||
{};
|
||||
|
||||
TEST_P(CodecTest_Performance, TranscodingWithDataType)
|
||||
TEST_P(CodecTestPerformance, TranscodingWithDataType)
|
||||
{
|
||||
const auto & [codec_spec, test_seq] = GetParam();
|
||||
const auto codec = ::makeCodec(codec_spec.codec_statement, test_seq.data_type);
|
||||
@ -1295,7 +1295,7 @@ INSTANTIATE_TEST_SUITE_P(Gorilla,
|
||||
//};
|
||||
|
||||
//INSTANTIATE_TEST_SUITE_P(DoubleDelta,
|
||||
// CodecTest_Performance,
|
||||
// CodecTestPerformance,
|
||||
// ::testing::Combine(
|
||||
// ::testing::Values(Codec("DoubleDelta")),
|
||||
// ::testing::Values(
|
||||
@ -1312,7 +1312,7 @@ INSTANTIATE_TEST_SUITE_P(Gorilla,
|
||||
//);
|
||||
|
||||
//INSTANTIATE_TEST_SUITE_P(Gorilla,
|
||||
// CodecTest_Performance,
|
||||
// CodecTestPerformance,
|
||||
// ::testing::Combine(
|
||||
// ::testing::Values(Codec("Gorilla")),
|
||||
// ::testing::Values(
|
||||
|
@ -27,7 +27,7 @@ const UInt64 BIT_PATTERN = 0b11101011'11101111'10111010'11101111'10101111'101110
|
||||
const uint8_t PRIMES[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61};
|
||||
|
||||
template <typename T>
|
||||
std::string bin(const T & value, size_t bits = sizeof(T)*8)
|
||||
std::string bin(const T & value, size_t bits = sizeof(T) * 8)
|
||||
{
|
||||
static const uint8_t MAX_BITS = sizeof(T)*8;
|
||||
assert(bits <= MAX_BITS);
|
||||
@ -150,7 +150,7 @@ TEST_P(BitIO, WriteAndRead)
|
||||
ReadBufferFromMemory read_buffer(data.data(), data.size());
|
||||
// auto memory_read_buffer = memory_write_buffer.tryGetReadBuffer();
|
||||
|
||||
if (expected_buffer_binary != std::string{})
|
||||
if (!expected_buffer_binary.empty())
|
||||
{
|
||||
const auto actual_buffer_binary = dumpContents(data, " ", " ");
|
||||
ASSERT_EQ(expected_buffer_binary, actual_buffer_binary);
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
using namespace DB;
|
||||
|
||||
TEST(MergeTreeSetIndex, checkInRange_one)
|
||||
TEST(MergeTreeSetIndex, checkInRangeOne)
|
||||
{
|
||||
DataTypes types = {std::make_shared<const DataTypeInt64>()};
|
||||
|
||||
@ -34,7 +34,7 @@ TEST(MergeTreeSetIndex, checkInRange_one)
|
||||
ranges = {Range(-1, true, 10, true)};
|
||||
ASSERT_EQ(set->checkInRange(ranges, types).can_be_true, true) << "(-1, 10)";
|
||||
|
||||
// Left bounded
|
||||
// Left bounded
|
||||
ranges = {Range::createLeftBounded(1, true)};
|
||||
ASSERT_EQ(set->checkInRange(ranges, types).can_be_true, true) << "(1, +inf)";
|
||||
|
||||
@ -55,7 +55,7 @@ TEST(MergeTreeSetIndex, checkInRange_one)
|
||||
ASSERT_EQ(set->checkInRange(ranges, types).can_be_true, true) << "(-inf, 10)";
|
||||
}
|
||||
|
||||
TEST(MergeTreeSetIndex, checkInRange_tuple)
|
||||
TEST(MergeTreeSetIndex, checkInRangeTuple)
|
||||
{
|
||||
DataTypes types = {std::make_shared<const DataTypeUInt64>(), std::make_shared<const DataTypeString>()};
|
||||
|
||||
|
@ -75,12 +75,12 @@ void MergeTreeIndexGranuleBloomFilter::deserializeBinary(ReadBuffer & istr)
|
||||
throw Exception("Cannot read data to a non-empty bloom filter index.", ErrorCodes::LOGICAL_ERROR);
|
||||
|
||||
readVarUInt(total_rows, istr);
|
||||
for (size_t index = 0; index < bloom_filters.size(); ++index)
|
||||
for (auto & filter : bloom_filters)
|
||||
{
|
||||
static size_t atom_size = 8;
|
||||
size_t bytes_size = (bits_per_row * total_rows + atom_size - 1) / atom_size;
|
||||
bloom_filters[index] = std::make_shared<BloomFilter>(bytes_size, hash_functions, 0);
|
||||
istr.read(reinterpret_cast<char *>(bloom_filters[index]->getFilter().data()), bytes_size);
|
||||
filter = std::make_shared<BloomFilter>(bytes_size, hash_functions, 0);
|
||||
istr.read(reinterpret_cast<char *>(filter->getFilter().data()), bytes_size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -118,13 +118,9 @@ void MergeTreeIndexGranuleBloomFilter::fillingBloomFilter(BloomFilterPtr & bf, c
|
||||
{
|
||||
const auto & hash_column_vec = hash_column->getData();
|
||||
|
||||
for (size_t index = 0, size = hash_column_vec.size(); index < size; ++index)
|
||||
{
|
||||
const UInt64 & bf_base_hash = hash_column_vec[index];
|
||||
|
||||
for (const auto & bf_base_hash : hash_column_vec)
|
||||
for (size_t i = 0; i < hash_functions; ++i)
|
||||
bf->addHashWithSeed(bf_base_hash, BloomFilterHash::bf_hash_seed[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
typedef testing::Types<DB::DiskMemory, DB::DiskLocal> DiskImplementations;
|
||||
using DiskImplementations = testing::Types<DB::DiskMemory, DB::DiskLocal>;
|
||||
TYPED_TEST_SUITE(StorageLogTest, DiskImplementations);
|
||||
|
||||
// Returns data written to table in Values format.
|
||||
|
@ -57,46 +57,46 @@ static void check(const std::string & query, const std::string & expected, const
|
||||
TEST(TransformQueryForExternalDatabase, InWithSingleElement)
|
||||
{
|
||||
check("SELECT column FROM test.table WHERE 1 IN (1)",
|
||||
"SELECT \"column\" FROM \"test\".\"table\" WHERE 1",
|
||||
R"(SELECT "column" FROM "test"."table" WHERE 1)",
|
||||
state().context, state().columns);
|
||||
check("SELECT column FROM test.table WHERE column IN (1, 2)",
|
||||
"SELECT \"column\" FROM \"test\".\"table\" WHERE \"column\" IN (1, 2)",
|
||||
R"(SELECT "column" FROM "test"."table" WHERE "column" IN (1, 2))",
|
||||
state().context, state().columns);
|
||||
check("SELECT column FROM test.table WHERE column NOT IN ('hello', 'world')",
|
||||
"SELECT \"column\" FROM \"test\".\"table\" WHERE \"column\" NOT IN ('hello', 'world')",
|
||||
R"(SELECT "column" FROM "test"."table" WHERE "column" NOT IN ('hello', 'world'))",
|
||||
state().context, state().columns);
|
||||
}
|
||||
|
||||
TEST(TransformQueryForExternalDatabase, Like)
|
||||
{
|
||||
check("SELECT column FROM test.table WHERE column LIKE '%hello%'",
|
||||
"SELECT \"column\" FROM \"test\".\"table\" WHERE \"column\" LIKE '%hello%'",
|
||||
R"(SELECT "column" FROM "test"."table" WHERE "column" LIKE '%hello%')",
|
||||
state().context, state().columns);
|
||||
check("SELECT column FROM test.table WHERE column NOT LIKE 'w%rld'",
|
||||
"SELECT \"column\" FROM \"test\".\"table\" WHERE \"column\" NOT LIKE 'w%rld'",
|
||||
R"(SELECT "column" FROM "test"."table" WHERE "column" NOT LIKE 'w%rld')",
|
||||
state().context, state().columns);
|
||||
}
|
||||
|
||||
TEST(TransformQueryForExternalDatabase, Substring)
|
||||
{
|
||||
check("SELECT column FROM test.table WHERE left(column, 10) = RIGHT(column, 10) AND SUBSTRING(column FROM 1 FOR 2) = 'Hello'",
|
||||
"SELECT \"column\" FROM \"test\".\"table\"",
|
||||
R"(SELECT "column" FROM "test"."table")",
|
||||
state().context, state().columns);
|
||||
}
|
||||
|
||||
TEST(TransformQueryForExternalDatabase, MultipleAndSubqueries)
|
||||
{
|
||||
check("SELECT column FROM test.table WHERE 1 = 1 AND toString(column) = '42' AND column = 42 AND left(column, 10) = RIGHT(column, 10) AND column IN (1, 42) AND SUBSTRING(column FROM 1 FOR 2) = 'Hello' AND column != 4",
|
||||
"SELECT \"column\" FROM \"test\".\"table\" WHERE 1 AND (\"column\" = 42) AND (\"column\" IN (1, 42)) AND (\"column\" != 4)",
|
||||
R"(SELECT "column" FROM "test"."table" WHERE 1 AND ("column" = 42) AND ("column" IN (1, 42)) AND ("column" != 4))",
|
||||
state().context, state().columns);
|
||||
check("SELECT column FROM test.table WHERE toString(column) = '42' AND left(column, 10) = RIGHT(column, 10) AND column = 42",
|
||||
"SELECT \"column\" FROM \"test\".\"table\" WHERE (\"column\" = 42)",
|
||||
R"(SELECT "column" FROM "test"."table" WHERE ("column" = 42))",
|
||||
state().context, state().columns);
|
||||
}
|
||||
|
||||
TEST(TransformQueryForExternalDatabase, Issue7245)
|
||||
{
|
||||
check("select apply_id from test.table where apply_type = 2 and create_time > addDays(toDateTime('2019-01-01 01:02:03'),-7) and apply_status in (3,4)",
|
||||
"SELECT \"apply_id\", \"apply_type\", \"apply_status\", \"create_time\" FROM \"test\".\"table\" WHERE (\"apply_type\" = 2) AND (\"create_time\" > '2018-12-25 01:02:03') AND (\"apply_status\" IN (3, 4))",
|
||||
R"(SELECT "apply_id", "apply_type", "apply_status", "create_time" FROM "test"."table" WHERE ("apply_type" = 2) AND ("create_time" > '2018-12-25 01:02:03') AND ("apply_status" IN (3, 4)))",
|
||||
state().context, state().columns);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user