ClickHouse/src/Storages/MergeTree/MergeTreeThreadSelectProcessor.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.8 KiB
C++
Raw Normal View History

2015-06-24 11:03:53 +00:00
#pragma once
2019-10-01 16:50:08 +00:00
#include <Storages/MergeTree/MergeTreeBaseSelectProcessor.h>
2015-06-24 11:03:53 +00:00
namespace DB
{
2016-11-20 12:43:20 +00:00
class MergeTreeReadPool;
/** Used in conjunction with MergeTreeReadPool, asking it for more work to do and performing whatever reads it is asked
* to perform.
*/
class MergeTreeThreadSelectProcessor final : public MergeTreeBaseSelectProcessor
2015-06-24 11:03:53 +00:00
{
public:
2021-07-26 16:48:25 +00:00
MergeTreeThreadSelectProcessor(
size_t thread_,
2019-08-03 11:02:40 +00:00
const std::shared_ptr<MergeTreeReadPool> & pool_,
size_t min_marks_to_read_,
UInt64 max_block_size_,
2019-08-03 11:02:40 +00:00
size_t preferred_block_size_bytes_,
size_t preferred_max_column_in_block_size_bytes_,
const MergeTreeData & storage_,
const StorageSnapshotPtr & storage_snapshot_,
bool use_uncompressed_cache_,
2019-08-03 11:02:40 +00:00
const PrewhereInfoPtr & prewhere_info_,
2021-06-25 14:49:28 +00:00
ExpressionActionsSettings actions_settings,
const MergeTreeReaderSettings & reader_settings_,
const Names & virt_column_names_,
std::optional<ParallelReadingExtension> extension_);
2015-06-24 11:03:53 +00:00
2016-11-20 12:43:20 +00:00
String getName() const override { return "MergeTreeThread"; }
2021-07-26 16:48:25 +00:00
~MergeTreeThreadSelectProcessor() override;
2015-06-24 11:03:53 +00:00
protected:
/// Requests read task from MergeTreeReadPool and signals whether it got one
bool getNewTaskImpl() override;
void finalizeNewTask() override;
void finish() override;
bool canUseConsistentHashingForParallelReading() override { return true; }
2015-07-03 15:08:21 +00:00
2018-04-16 12:21:36 +00:00
private:
/// "thread" index (there are N threads and each thread is assigned index in interval [0..N-1])
size_t thread;
2015-07-03 15:08:21 +00:00
2016-11-20 12:43:20 +00:00
std::shared_ptr<MergeTreeReadPool> pool;
size_t min_marks_to_read;
2018-04-16 12:21:36 +00:00
2020-08-08 01:01:47 +00:00
/// Last part read in this thread
2020-04-14 19:47:19 +00:00
std::string last_readed_part_name;
2018-04-19 15:18:26 +00:00
/// Names from header. Used in order to order columns in read blocks.
2018-04-16 12:21:36 +00:00
Names ordered_names;
2015-06-24 11:03:53 +00:00
};
}