ClickHouse/dbms/include/DB/Storages/MergeTree/MergeTreeThreadBlockInputStream.h
Alexey Milovidov 58e5dad1a1 Squashed commit of the following:
commit e712f469a5
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:59:13 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 2a00282308
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:58:30 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 9e06f407c8
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:55:14 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 9581620f1e
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:54:22 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 2a8564c68c
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:47:34 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit cf60632d78
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:40:09 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit ee3d1dc6e0
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:22:49 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 65592ef711
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:18:17 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 37972c2573
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:17:06 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit dd909d1499
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:16:28 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 3cf43266ca
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:15:42 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 6731a3df96
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:13:35 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 1b5727e0d5
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:11:18 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit bbcf726a55
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:09:04 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit c03b477d5e
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:06:30 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 2986e2fb04
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:05:44 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit 5d6cdef13d
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:04:53 2017 +0300

    Less dependencies [#CLICKHOUSE-2]

commit f2b819b25c
Author: Alexey Milovidov <milovidov@yandex-team.ru>
Date:   Sat Jan 14 11:01:47 2017 +0300

    Less dependencies [#CLICKHOUSE-2]
2017-01-14 12:00:19 +03:00

75 lines
2.1 KiB
C++

#pragma once
#include <DB/DataStreams/IProfilingBlockInputStream.h>
#include <DB/Storages/MergeTree/MergeTreeData.h>
namespace DB
{
class MergeTreeReader;
class MergeTreeReadPool;
struct MergeTreeReadTask;
class UncompressedCache;
class MarkCache;
/** Used in conjunction with MergeTreeReadPool, asking it for more work to do and performing whatever reads it is asked
* to perform.
*/
class MergeTreeThreadBlockInputStream : public IProfilingBlockInputStream
{
/// "thread" index (there are N threads and each thread is assigned index in interval [0..N-1])
std::size_t thread;
public:
MergeTreeThreadBlockInputStream(
const std::size_t thread,
const std::shared_ptr<MergeTreeReadPool> & pool, const std::size_t min_marks_to_read, const std::size_t block_size,
MergeTreeData & storage, const bool use_uncompressed_cache, const ExpressionActionsPtr & prewhere_actions,
const String & prewhere_column, const Settings & settings, const Names & virt_column_names);
~MergeTreeThreadBlockInputStream() override;
String getName() const override { return "MergeTreeThread"; }
String getID() const override;
protected:
/// Будем вызывать progressImpl самостоятельно.
void progress(const Progress & value) override {}
Block readImpl() override;
private:
/// Requests read task from MergeTreeReadPool and signals whether it got one
bool getNewTask();
Block readFromPart();
void injectVirtualColumns(Block & block);
std::shared_ptr<MergeTreeReadPool> pool;
const std::size_t block_size_marks;
const std::size_t min_marks_to_read;
MergeTreeData & storage;
const bool use_uncompressed_cache;
ExpressionActionsPtr prewhere_actions;
const String prewhere_column;
const std::size_t min_bytes_to_use_direct_io;
const std::size_t max_read_buffer_size;
const Names virt_column_names;
Logger * log;
using MergeTreeReaderPtr = std::unique_ptr<MergeTreeReader>;
std::shared_ptr<UncompressedCache> owned_uncompressed_cache;
std::shared_ptr<MarkCache> owned_mark_cache;
std::shared_ptr<MergeTreeReadTask> task;
MergeTreeReaderPtr reader;
MergeTreeReaderPtr pre_reader;
};
}