2015-06-24 11:03:53 +00:00
|
|
|
#pragma once
|
2017-04-06 17:21:45 +00:00
|
|
|
#include "MergeTreeBaseBlockInputStream.h"
|
2015-06-24 11:03:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2016-11-20 12:43:20 +00:00
|
|
|
class MergeTreeReadPool;
|
2017-03-24 13:52:50 +00:00
|
|
|
|
|
|
|
|
2015-09-09 17:39:28 +00:00
|
|
|
/** Used in conjunction with MergeTreeReadPool, asking it for more work to do and performing whatever reads it is asked
|
2016-12-10 04:51:36 +00:00
|
|
|
* to perform.
|
|
|
|
*/
|
2017-03-24 13:52:50 +00:00
|
|
|
class MergeTreeThreadBlockInputStream : public MergeTreeBaseBlockInputStream
|
2015-06-24 11:03:53 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-04-01 07:20:54 +00:00
|
|
|
MergeTreeThreadBlockInputStream(
|
2017-03-24 13:52:50 +00:00
|
|
|
const size_t thread,
|
|
|
|
const std::shared_ptr<MergeTreeReadPool> & pool,
|
|
|
|
const size_t min_marks_to_read,
|
|
|
|
const size_t max_block_size,
|
2017-04-06 17:21:45 +00:00
|
|
|
size_t preferred_block_size_bytes,
|
2017-06-30 16:28:27 +00:00
|
|
|
size_t preferred_max_column_in_block_size_bytes,
|
2017-03-24 13:52:50 +00:00
|
|
|
MergeTreeData & storage,
|
|
|
|
const bool use_uncompressed_cache,
|
|
|
|
const ExpressionActionsPtr & prewhere_actions,
|
|
|
|
const String & prewhere_column,
|
|
|
|
const Settings & settings,
|
|
|
|
const Names & virt_column_names);
|
2015-06-24 11:03:53 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
String getName() const override { return "MergeTreeThread"; }
|
2015-12-21 20:17:24 +00:00
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
String getID() const override;
|
2015-06-24 11:03:53 +00:00
|
|
|
|
2017-03-24 13:52:50 +00:00
|
|
|
~MergeTreeThreadBlockInputStream() override;
|
|
|
|
|
2015-06-24 11:03:53 +00:00
|
|
|
protected:
|
2017-04-01 07:20:54 +00:00
|
|
|
/// Requests read task from MergeTreeReadPool and signals whether it got one
|
2017-04-05 20:34:19 +00:00
|
|
|
bool getNewTask() override;
|
2015-07-03 15:08:21 +00:00
|
|
|
|
2017-03-24 13:52:50 +00:00
|
|
|
/// "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
|
|
|
|
2017-04-01 07:20:54 +00:00
|
|
|
std::shared_ptr<MergeTreeReadPool> pool;
|
2017-03-24 13:52:50 +00:00
|
|
|
size_t min_marks_to_read;
|
2015-06-24 11:03:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|