2020-10-10 18:37:02 +00:00
|
|
|
#pragma once
|
2022-08-28 18:42:11 +00:00
|
|
|
|
2019-11-20 13:33:41 +00:00
|
|
|
#include <Storages/MarkCache.h>
|
2022-07-18 12:09:57 +00:00
|
|
|
#include <IO/ReadSettings.h>
|
2023-04-06 17:00:51 +00:00
|
|
|
#include <Common/ThreadPool_fwd.h>
|
2023-04-30 08:56:43 +00:00
|
|
|
#include <Storages/MergeTree/IMergeTreeDataPartInfoForReader.h>
|
2019-11-20 13:33:41 +00:00
|
|
|
|
2022-08-28 18:42:11 +00:00
|
|
|
|
2019-11-20 13:33:41 +00:00
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2020-02-03 12:46:25 +00:00
|
|
|
struct MergeTreeIndexGranularityInfo;
|
2022-08-30 17:47:34 +00:00
|
|
|
class Threadpool;
|
2020-02-03 12:46:25 +00:00
|
|
|
|
2019-11-20 13:33:41 +00:00
|
|
|
class MergeTreeMarksLoader
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
using MarksPtr = MarkCache::MappedPtr;
|
|
|
|
|
2020-02-03 12:46:25 +00:00
|
|
|
MergeTreeMarksLoader(
|
2023-04-30 08:56:43 +00:00
|
|
|
MergeTreeDataPartInfoForReaderPtr data_part_reader_,
|
2020-02-03 12:46:25 +00:00
|
|
|
MarkCache * mark_cache_,
|
|
|
|
const String & mrk_path,
|
|
|
|
size_t marks_count_,
|
|
|
|
const MergeTreeIndexGranularityInfo & index_granularity_info_,
|
2019-11-20 13:33:41 +00:00
|
|
|
bool save_marks_in_cache_,
|
2022-07-18 12:09:57 +00:00
|
|
|
const ReadSettings & read_settings_,
|
2022-09-05 18:12:40 +00:00
|
|
|
ThreadPool * load_marks_threadpool_,
|
2020-03-09 02:26:50 +00:00
|
|
|
size_t columns_in_mark_ = 1);
|
2019-12-18 16:41:11 +00:00
|
|
|
|
2022-08-31 13:39:53 +00:00
|
|
|
~MergeTreeMarksLoader();
|
|
|
|
|
2023-03-07 05:09:13 +00:00
|
|
|
MarkInCompressedFile getMark(size_t row_index, size_t column_index = 0);
|
2019-11-20 13:33:41 +00:00
|
|
|
|
|
|
|
private:
|
2023-04-30 08:56:43 +00:00
|
|
|
MergeTreeDataPartInfoForReaderPtr data_part_reader;
|
2019-11-20 13:33:41 +00:00
|
|
|
MarkCache * mark_cache = nullptr;
|
|
|
|
String mrk_path;
|
2020-02-03 12:46:25 +00:00
|
|
|
size_t marks_count;
|
|
|
|
const MergeTreeIndexGranularityInfo & index_granularity_info;
|
2019-11-20 13:33:41 +00:00
|
|
|
bool save_marks_in_cache = false;
|
2020-02-03 16:37:00 +00:00
|
|
|
size_t columns_in_mark;
|
2020-02-03 12:46:25 +00:00
|
|
|
MarkCache::MappedPtr marks;
|
2022-07-18 12:09:57 +00:00
|
|
|
ReadSettings read_settings;
|
2019-11-20 13:33:41 +00:00
|
|
|
|
2022-08-30 17:47:34 +00:00
|
|
|
MarkCache::MappedPtr loadMarks();
|
|
|
|
std::future<MarkCache::MappedPtr> loadMarksAsync();
|
2020-02-03 12:46:25 +00:00
|
|
|
MarkCache::MappedPtr loadMarksImpl();
|
2022-08-30 17:47:34 +00:00
|
|
|
|
|
|
|
std::future<MarkCache::MappedPtr> future;
|
2022-09-05 18:12:40 +00:00
|
|
|
ThreadPool * load_marks_threadpool;
|
2019-11-20 13:33:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|