mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-01 03:52:15 +00:00
Attempt to normalize big integers
This commit is contained in:
parent
76a5d023e0
commit
9eb60086b0
@ -251,7 +251,9 @@ TEST(WeakHash32, ColumnVectorU128)
|
||||
{
|
||||
for (uint64_t i = 0; i < 65536; ++i)
|
||||
{
|
||||
UInt128 val(i << 32u, i << 32u);
|
||||
UInt128 val;
|
||||
val.items[0] = i << 32u;
|
||||
val.items[1] = i << 32u;
|
||||
data.push_back(val);
|
||||
eq_data.push_back(i);
|
||||
}
|
||||
@ -328,7 +330,7 @@ TEST(WeakHash32, ColumnDecimal128)
|
||||
WeakHash32 hash(col->size());
|
||||
col->updateWeakHash32(hash);
|
||||
|
||||
checkColumn(hash.getData(), col->getData(), [&](size_t row) { return std::to_string(Int64(col->getElement(row))); });
|
||||
checkColumn(hash.getData(), col->getData(), [&](size_t row) { return std::to_string(Int128(col->getElement(row).value)); });
|
||||
}
|
||||
|
||||
TEST(WeakHash32, ColumnString1)
|
||||
|
@ -5,11 +5,16 @@
|
||||
|
||||
#include <Common/HashTable/HashMap.h>
|
||||
#include <Common/HashTable/HashSet.h>
|
||||
#include <Common/HashTable/Hash.h>
|
||||
|
||||
#include <IO/ReadBufferFromString.h>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
|
||||
using namespace DB;
|
||||
|
||||
|
||||
/// To test dump functionality without using other hashes that can change
|
||||
template <typename T>
|
||||
struct DummyHash
|
||||
@ -251,14 +256,14 @@ TEST(HashTable, SerializationDeserialization)
|
||||
cont.insert(2);
|
||||
cont.insert(3);
|
||||
|
||||
DB::WriteBufferFromOwnString wb;
|
||||
WriteBufferFromOwnString wb;
|
||||
cont.writeText(wb);
|
||||
|
||||
std::string expected = "3,1,2,3";
|
||||
|
||||
ASSERT_EQ(wb.str(), expected);
|
||||
|
||||
DB::ReadBufferFromString rb(expected);
|
||||
ReadBufferFromString rb(expected);
|
||||
|
||||
Cont deserialized;
|
||||
deserialized.readText(rb);
|
||||
@ -273,10 +278,10 @@ TEST(HashTable, SerializationDeserialization)
|
||||
cont.insert(2);
|
||||
cont.insert(3);
|
||||
|
||||
DB::WriteBufferFromOwnString wb;
|
||||
WriteBufferFromOwnString wb;
|
||||
cont.write(wb);
|
||||
|
||||
DB::ReadBufferFromString rb(wb.str());
|
||||
ReadBufferFromString rb(wb.str());
|
||||
|
||||
Cont deserialized;
|
||||
deserialized.read(rb);
|
||||
@ -286,23 +291,23 @@ TEST(HashTable, SerializationDeserialization)
|
||||
using Cont = HashSet<int, DummyHash<int>, HashTableGrower<1>>;
|
||||
Cont cont;
|
||||
|
||||
DB::WriteBufferFromOwnString wb;
|
||||
WriteBufferFromOwnString wb;
|
||||
cont.writeText(wb);
|
||||
|
||||
std::string expected = "0";
|
||||
ASSERT_EQ(wb.str(), expected);
|
||||
|
||||
DB::ReadBufferFromString rb(expected);
|
||||
ReadBufferFromString rb(expected);
|
||||
|
||||
Cont deserialized;
|
||||
deserialized.readText(rb);
|
||||
ASSERT_EQ(convertToSet(cont), convertToSet(deserialized));
|
||||
}
|
||||
{
|
||||
using Cont = HashSet<DB::UInt128, DB::UInt128TrivialHash>;
|
||||
using Cont = HashSet<UInt128, UInt128TrivialHash>;
|
||||
Cont cont;
|
||||
|
||||
DB::WriteBufferFromOwnString wb;
|
||||
WriteBufferFromOwnString wb;
|
||||
cont.write(wb);
|
||||
|
||||
std::string expected;
|
||||
@ -310,7 +315,7 @@ TEST(HashTable, SerializationDeserialization)
|
||||
|
||||
ASSERT_EQ(wb.str(), expected);
|
||||
|
||||
DB::ReadBufferFromString rb(expected);
|
||||
ReadBufferFromString rb(expected);
|
||||
|
||||
Cont deserialized;
|
||||
deserialized.read(rb);
|
||||
|
@ -248,7 +248,7 @@ INSTANTIATE_TEST_SUITE_P(Merge, ReplicatedMergeTreeLogEntryDataTest,
|
||||
.new_part_type = MergeTreeDataPartType::WIDE,
|
||||
|
||||
// Format version 5
|
||||
.new_part_uuid = UUID(UInt128(123456789, 10111213141516)),
|
||||
.new_part_uuid = UUID(UInt128(std::initializer_list<UInt64>{123456789, 10111213141516})),
|
||||
|
||||
.create_time = 123,
|
||||
},
|
||||
@ -273,7 +273,7 @@ INSTANTIATE_TEST_SUITE_P(Merge, ReplicatedMergeTreeLogEntryDataTest,
|
||||
.new_part_type = MergeTreeDataPartType::WIDE,
|
||||
|
||||
// Mixing features
|
||||
.new_part_uuid = UUID(UInt128(123456789, 10111213141516)),
|
||||
.new_part_uuid = UUID(UInt128(std::initializer_list<UInt64>{123456789, 10111213141516})),
|
||||
.deduplicate = true,
|
||||
.deduplicate_by_columns = {"foo", "bar", "qux"},
|
||||
|
||||
@ -288,7 +288,7 @@ INSTANTIATE_TEST_SUITE_P(Merge, ReplicatedMergeTreeLogEntryDataTest,
|
||||
.new_part_type = MergeTreeDataPartType::WIDE,
|
||||
|
||||
// Mixing features
|
||||
.new_part_uuid = UUID(UInt128(123456789, 10111213141516)),
|
||||
.new_part_uuid = UUID(UInt128(std::initializer_list<UInt64>{123456789, 10111213141516})),
|
||||
.deduplicate = true,
|
||||
.deduplicate_by_columns = {"name with space", "\"column\"", "'column'", "колонка", "\u30ab\u30e9\u30e0", "\x01\x03 column \x10\x11\x12"},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user