1#pragma once
2
3#include <tuple>
4
5#include <Core/Types.h>
6#include <IO/WriteHelpers.h>
7#include <Common/PODArray.h>
8
9
10namespace DB
11{
12
13/** Mark is the position in the compressed file. The compressed file consists of adjacent compressed blocks.
14 * 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.
15 */
16struct MarkInCompressedFile
17{
18 size_t offset_in_compressed_file;
19 size_t offset_in_decompressed_block;
20
21 bool operator==(const MarkInCompressedFile & rhs) const
22 {
23 return std::tie(offset_in_compressed_file, offset_in_decompressed_block)
24 == std::tie(rhs.offset_in_compressed_file, rhs.offset_in_decompressed_block);
25 }
26 bool operator!=(const MarkInCompressedFile & rhs) const
27 {
28 return !(*this == rhs);
29 }
30
31 String toString() const
32 {
33 return "(" + DB::toString(offset_in_compressed_file) + "," + DB::toString(offset_in_decompressed_block) + ")";
34 }
35
36 String toStringWithRows(size_t rows_num)
37 {
38 return "(" + DB::toString(offset_in_compressed_file) + "," + DB::toString(offset_in_decompressed_block) + "," + DB::toString(rows_num) + ")";
39 }
40
41};
42
43using MarksInCompressedFile = PODArray<MarkInCompressedFile>;
44
45}
46