ClickHouse/src/Processors/QueryPlan/JoinStep.h
2022-07-12 22:20:08 +08:00

60 lines
1.5 KiB
C++

#pragma once
#include <Processors/QueryPlan/IQueryPlanStep.h>
#include <Processors/QueryPlan/ITransformingStep.h>
namespace DB
{
class IJoin;
using JoinPtr = std::shared_ptr<IJoin>;
/// Join two data streams.
class JoinStep : public IQueryPlanStep
{
public:
JoinStep(
const DataStream & left_stream_,
const DataStream & right_stream_,
JoinPtr join_,
size_t max_block_size_,
size_t max_streams_,
bool keep_left_read_in_order_);
String getName() const override { return "Join"; }
QueryPipelineBuilderPtr updatePipeline(QueryPipelineBuilders pipelines, const BuildQueryPipelineSettings &) override;
void describePipeline(FormatSettings & settings) const override;
const JoinPtr & getJoin() const { return join; }
void updateLeftStream(const DataStream & left_stream_);
private:
JoinPtr join;
size_t max_block_size;
size_t max_streams;
bool keep_left_read_in_order;
Processors processors;
};
/// Special step for the case when Join is already filled.
/// For StorageJoin and Dictionary.
class FilledJoinStep : public ITransformingStep
{
public:
FilledJoinStep(const DataStream & input_stream_, JoinPtr join_, size_t max_block_size_);
String getName() const override { return "FilledJoin"; }
void transformPipeline(QueryPipelineBuilder & pipeline, const BuildQueryPipelineSettings &) override;
private:
void updateOutputStream() override;
JoinPtr join;
size_t max_block_size;
};
}