mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-14 10:22:10 +00:00
d8adf05de2
Added a new virtual column _block_number which is persisted on merges when allow_experimental_block_number_column is enabled
24 lines
847 B
C++
24 lines
847 B
C++
#include <Storages/BlockNumberColumn.h>
|
|
#include <Compression/CompressionCodecMultiple.h>
|
|
|
|
namespace DB
|
|
{
|
|
|
|
CompressionCodecPtr getCompressionCodecDelta(UInt8 delta_bytes_size);
|
|
|
|
CompressionCodecPtr getCompressionCodecForBlockNumberColumn()
|
|
{
|
|
std::vector <CompressionCodecPtr> codecs;
|
|
codecs.reserve(2);
|
|
auto data_bytes_size = BlockNumberColumn::type->getSizeOfValueInMemory();
|
|
codecs.emplace_back(getCompressionCodecDelta(data_bytes_size));
|
|
codecs.emplace_back(CompressionCodecFactory::instance().get("LZ4", {}));
|
|
return std::make_shared<CompressionCodecMultiple>(codecs);
|
|
}
|
|
|
|
const String BlockNumberColumn::name = "_block_number";
|
|
const DataTypePtr BlockNumberColumn::type = std::make_shared<DataTypeUInt64>();
|
|
const CompressionCodecPtr BlockNumberColumn::compression_codec = getCompressionCodecForBlockNumberColumn();
|
|
|
|
}
|