mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
use standard Tuple serialization [#CLICKHOUSE-4054]
This commit is contained in:
parent
d9a0432c6c
commit
3a3dda5ec5
@ -5,6 +5,8 @@
|
||||
#include <IO/HashingWriteBuffer.h>
|
||||
#include <Common/FieldVisitors.h>
|
||||
#include <DataTypes/DataTypeDate.h>
|
||||
#include <DataTypes/DataTypeTuple.h>
|
||||
#include <Columns/ColumnTuple.h>
|
||||
#include <Common/SipHash.h>
|
||||
#include <Common/typeid_cast.h>
|
||||
#include <Common/hex.h>
|
||||
@ -94,18 +96,20 @@ void MergeTreePartition::serializeText(const MergeTreeData & storage, WriteBuffe
|
||||
}
|
||||
else
|
||||
{
|
||||
writeChar('(', out);
|
||||
DataTypes types;
|
||||
Columns columns;
|
||||
for (size_t i = 0; i < key_size; ++i)
|
||||
{
|
||||
if (i > 0)
|
||||
writeCString(", ", out);
|
||||
|
||||
const DataTypePtr & type = storage.partition_key_sample.getByPosition(i).type;
|
||||
const auto & type = storage.partition_key_sample.getByPosition(i).type;
|
||||
types.push_back(type);
|
||||
auto column = type->createColumn();
|
||||
column->insert(value[i]);
|
||||
type->serializeTextQuoted(*column, 0, out, format_settings);
|
||||
columns.push_back(std::move(column));
|
||||
}
|
||||
writeChar(')', out);
|
||||
|
||||
DataTypeTuple tuple_type(types);
|
||||
auto tuple_column = ColumnTuple::create(columns);
|
||||
tuple_type.serializeText(*tuple_column, 0, out, format_settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,15 +22,15 @@ Sum after DROP PARTITION:
|
||||
12
|
||||
*** Partitioned by a (Date, UInt8) tuple ***
|
||||
Parts before OPTIMIZE:
|
||||
(\'2000-01-01\', 1) 20000101-1_1_1_0
|
||||
(\'2000-01-01\', 1) 20000101-1_5_5_0
|
||||
(\'2000-01-01\', 2) 20000101-2_2_2_0
|
||||
(\'2000-01-02\', 1) 20000102-1_3_3_0
|
||||
(\'2000-01-02\', 1) 20000102-1_4_4_0
|
||||
(\'2000-01-01\',1) 20000101-1_1_1_0
|
||||
(\'2000-01-01\',1) 20000101-1_5_5_0
|
||||
(\'2000-01-01\',2) 20000101-2_2_2_0
|
||||
(\'2000-01-02\',1) 20000102-1_3_3_0
|
||||
(\'2000-01-02\',1) 20000102-1_4_4_0
|
||||
Parts after OPTIMIZE:
|
||||
(\'2000-01-01\', 1) 20000101-1_1_5_1
|
||||
(\'2000-01-01\', 2) 20000101-2_2_2_0
|
||||
(\'2000-01-02\', 1) 20000102-1_3_4_1
|
||||
(\'2000-01-01\',1) 20000101-1_1_5_1
|
||||
(\'2000-01-01\',2) 20000101-2_2_2_0
|
||||
(\'2000-01-02\',1) 20000102-1_3_4_1
|
||||
Sum before DETACH PARTITION:
|
||||
15
|
||||
Sum after DETACH PARTITION:
|
||||
|
@ -22,15 +22,15 @@ Sum after DROP PARTITION:
|
||||
12
|
||||
*** Partitioned by a (Date, UInt8) tuple ***
|
||||
Parts before OPTIMIZE:
|
||||
(\'2000-01-01\', 1) 20000101-1_0_0_0
|
||||
(\'2000-01-01\', 1) 20000101-1_1_1_0
|
||||
(\'2000-01-01\', 2) 20000101-2_0_0_0
|
||||
(\'2000-01-02\', 1) 20000102-1_0_0_0
|
||||
(\'2000-01-02\', 1) 20000102-1_1_1_0
|
||||
(\'2000-01-01\',1) 20000101-1_0_0_0
|
||||
(\'2000-01-01\',1) 20000101-1_1_1_0
|
||||
(\'2000-01-01\',2) 20000101-2_0_0_0
|
||||
(\'2000-01-02\',1) 20000102-1_0_0_0
|
||||
(\'2000-01-02\',1) 20000102-1_1_1_0
|
||||
Parts after OPTIMIZE:
|
||||
(\'2000-01-01\', 1) 20000101-1_0_1_1
|
||||
(\'2000-01-01\', 2) 20000101-2_0_0_0
|
||||
(\'2000-01-02\', 1) 20000102-1_0_1_1
|
||||
(\'2000-01-01\',1) 20000101-1_0_1_1
|
||||
(\'2000-01-01\',2) 20000101-2_0_0_0
|
||||
(\'2000-01-02\',1) 20000102-1_0_1_1
|
||||
Sum before DETACH PARTITION:
|
||||
15
|
||||
Sum after DETACH PARTITION:
|
||||
|
Loading…
Reference in New Issue
Block a user