2015-08-16 07:01:41 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <tuple>
|
|
|
|
|
2017-04-01 09:19:00 +00:00
|
|
|
#include <Core/Types.h>
|
|
|
|
#include <IO/WriteHelpers.h>
|
|
|
|
#include <Common/PODArray.h>
|
2015-08-16 07:01:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2017-05-13 22:19:04 +00:00
|
|
|
/** Mark is the position in the compressed file. The compressed file consists of adjacent compressed blocks.
|
|
|
|
* Mark is a tuple - the offset in the file to the start of the compressed block, the offset in the decompressed block to the start of the data.
|
2015-08-16 07:01:41 +00:00
|
|
|
*/
|
|
|
|
struct MarkInCompressedFile
|
|
|
|
{
|
2017-04-01 07:20:54 +00:00
|
|
|
size_t offset_in_compressed_file;
|
|
|
|
size_t offset_in_decompressed_block;
|
|
|
|
|
|
|
|
bool operator==(const MarkInCompressedFile & rhs) const
|
|
|
|
{
|
|
|
|
return std::tie(offset_in_compressed_file, offset_in_decompressed_block)
|
|
|
|
== std::tie(rhs.offset_in_compressed_file, rhs.offset_in_decompressed_block);
|
|
|
|
}
|
|
|
|
bool operator!=(const MarkInCompressedFile & rhs) const
|
|
|
|
{
|
|
|
|
return !(*this == rhs);
|
|
|
|
}
|
|
|
|
|
|
|
|
String toString() const
|
|
|
|
{
|
|
|
|
return "(" + DB::toString(offset_in_compressed_file) + "," + DB::toString(offset_in_decompressed_block) + ")";
|
|
|
|
}
|
2019-03-20 16:18:13 +00:00
|
|
|
|
|
|
|
String toStringWithRows(size_t rows_num)
|
|
|
|
{
|
|
|
|
return "(" + DB::toString(offset_in_compressed_file) + "," + DB::toString(offset_in_decompressed_block) + "," + DB::toString(rows_num) + ")";
|
|
|
|
}
|
|
|
|
|
2015-08-16 07:01:41 +00:00
|
|
|
};
|
2019-08-28 19:01:52 +00:00
|
|
|
|
2016-11-20 12:43:20 +00:00
|
|
|
using MarksInCompressedFile = PODArray<MarkInCompressedFile>;
|
2019-08-29 12:38:20 +00:00
|
|
|
|
2015-08-16 07:01:41 +00:00
|
|
|
}
|