2021-04-29 10:03:55 +00:00
|
|
|
#pragma once
|
2022-07-07 08:28:06 +00:00
|
|
|
|
2021-04-27 17:30:33 +00:00
|
|
|
#include <Processors/QueryPlan/IQueryPlanStep.h>
|
2021-04-28 17:32:12 +00:00
|
|
|
#include <Processors/QueryPlan/ITransformingStep.h>
|
2021-04-27 17:30:33 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class IJoin;
|
|
|
|
using JoinPtr = std::shared_ptr<IJoin>;
|
|
|
|
|
2021-04-29 17:51:35 +00:00
|
|
|
/// Join two data streams.
|
2021-04-27 17:30:33 +00:00
|
|
|
class JoinStep : public IQueryPlanStep
|
|
|
|
{
|
|
|
|
public:
|
2021-04-28 17:32:12 +00:00
|
|
|
JoinStep(
|
2021-04-27 17:30:33 +00:00
|
|
|
const DataStream & left_stream_,
|
|
|
|
const DataStream & right_stream_,
|
|
|
|
JoinPtr join_,
|
2022-04-27 02:08:22 +00:00
|
|
|
size_t max_block_size_,
|
|
|
|
size_t max_streams_,
|
|
|
|
bool keep_left_read_in_order_);
|
2021-04-27 17:30:33 +00:00
|
|
|
|
|
|
|
String getName() const override { return "Join"; }
|
|
|
|
|
2021-09-14 16:28:41 +00:00
|
|
|
QueryPipelineBuilderPtr updatePipeline(QueryPipelineBuilders pipelines, const BuildQueryPipelineSettings &) override;
|
2021-04-28 17:32:12 +00:00
|
|
|
|
|
|
|
void describePipeline(FormatSettings & settings) const override;
|
2021-04-27 17:30:33 +00:00
|
|
|
|
2023-08-03 15:55:15 +00:00
|
|
|
void describeActions(JSONBuilder::JSONMap & map) const override;
|
|
|
|
void describeActions(FormatSettings & settings) const override;
|
|
|
|
|
2021-04-27 17:30:33 +00:00
|
|
|
const JoinPtr & getJoin() const { return join; }
|
2022-07-12 13:19:28 +00:00
|
|
|
bool allowPushDownToRight() const;
|
2021-04-27 17:30:33 +00:00
|
|
|
|
2023-09-14 12:36:41 +00:00
|
|
|
bool canUpdateInputStream() const override { return true; }
|
2022-06-27 11:16:52 +00:00
|
|
|
|
2021-04-27 17:30:33 +00:00
|
|
|
private:
|
2023-09-14 12:36:41 +00:00
|
|
|
void updateOutputStream() override;
|
|
|
|
|
2021-04-27 17:30:33 +00:00
|
|
|
JoinPtr join;
|
2021-04-28 17:32:12 +00:00
|
|
|
size_t max_block_size;
|
2022-04-27 02:08:22 +00:00
|
|
|
size_t max_streams;
|
|
|
|
bool keep_left_read_in_order;
|
2021-04-28 17:32:12 +00:00
|
|
|
};
|
|
|
|
|
2021-04-30 08:25:39 +00:00
|
|
|
/// Special step for the case when Join is already filled.
|
2021-04-29 17:51:35 +00:00
|
|
|
/// For StorageJoin and Dictionary.
|
2021-04-29 09:08:49 +00:00
|
|
|
class FilledJoinStep : public ITransformingStep
|
2021-04-28 17:32:12 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-04-29 09:08:49 +00:00
|
|
|
FilledJoinStep(const DataStream & input_stream_, JoinPtr join_, size_t max_block_size_);
|
2021-04-28 17:32:12 +00:00
|
|
|
|
2021-04-29 09:08:49 +00:00
|
|
|
String getName() const override { return "FilledJoin"; }
|
2021-09-14 16:28:41 +00:00
|
|
|
void transformPipeline(QueryPipelineBuilder & pipeline, const BuildQueryPipelineSettings &) override;
|
2021-04-28 17:32:12 +00:00
|
|
|
|
2023-03-06 11:50:09 +00:00
|
|
|
const JoinPtr & getJoin() const { return join; }
|
|
|
|
|
2021-04-28 17:32:12 +00:00
|
|
|
private:
|
2022-06-27 11:16:52 +00:00
|
|
|
void updateOutputStream() override;
|
|
|
|
|
2021-04-28 17:32:12 +00:00
|
|
|
JoinPtr join;
|
2021-04-27 17:30:33 +00:00
|
|
|
size_t max_block_size;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|