ClickHouse/dbms/Storages/MergeTree/MergeTreeReverseSelectProcessor.h

76 lines
2.2 KiB
C++
Raw Normal View History

#pragma once
#include <DataStreams/IBlockInputStream.h>
2019-10-01 16:50:08 +00:00
#include <Storages/MergeTree/MergeTreeThreadSelectBlockInputProcessor.h>
#include <Storages/MergeTree/MergeTreeData.h>
#include <Storages/MergeTree/MarkRange.h>
#include <Storages/MergeTree/MergeTreeBlockReadUtils.h>
#include <Storages/SelectQueryInfo.h>
namespace DB
{
/// Used to read data from single part with select query
/// Cares about PREWHERE, virtual columns, indexes etc.
/// To read data from multiple parts, Storage (MergeTree) creates multiple such objects.
2019-10-01 16:50:08 +00:00
class MergeTreeReverseSelectProcessor : public MergeTreeBaseSelectProcessor
{
public:
2019-10-01 16:50:08 +00:00
MergeTreeReverseSelectProcessor(
const MergeTreeData & storage,
const MergeTreeData::DataPartPtr & owned_data_part,
UInt64 max_block_size_rows,
size_t preferred_block_size_bytes,
size_t preferred_max_column_in_block_size_bytes,
2020-03-09 02:55:28 +00:00
Names required_columns_,
2019-10-04 15:40:05 +00:00
MarkRanges mark_ranges,
bool use_uncompressed_cache,
const PrewhereInfoPtr & prewhere_info,
bool check_columns,
const MergeTreeReaderSettings & reader_settings,
const Names & virt_column_names = {},
size_t part_index_in_query = 0,
bool quiet = false);
2019-10-01 16:50:08 +00:00
~MergeTreeReverseSelectProcessor() override;
String getName() const override { return "MergeTreeReverse"; }
/// Closes readers and unlock part locks
void finish();
protected:
bool getNewTask() override;
2019-10-01 16:50:08 +00:00
Chunk readFromPart() override;
private:
Block header;
/// Used by Task
Names required_columns;
/// Names from header. Used in order to order columns in read blocks.
Names ordered_names;
NameSet column_name_set;
2019-07-19 14:56:00 +00:00
MergeTreeReadTaskColumns task_columns;
/// Data part will not be removed if the pointer owns it
MergeTreeData::DataPartPtr data_part;
/// Mark ranges we should read (in ascending order)
MarkRanges all_mark_ranges;
/// Total number of marks we should read
size_t total_marks_count = 0;
/// Value of _part_index virtual column (used only in SelectExecutor)
size_t part_index_in_query = 0;
String path;
2019-10-01 16:50:08 +00:00
Chunks chunks;
2019-10-01 16:50:08 +00:00
Logger * log = &Logger::get("MergeTreeReverseSelectProcessor");
};
}