2019-09-09 19:43:37 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
2019-09-10 18:39:10 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include <Core/Names.h>
|
2019-09-12 12:24:19 +00:00
|
|
|
#include <Columns/IColumn.h>
|
2019-09-09 19:43:37 +00:00
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class Block;
|
2020-01-15 20:33:29 +00:00
|
|
|
struct ExtraBlock;
|
2020-12-10 23:56:57 +00:00
|
|
|
using ExtraBlockPtr = std::shared_ptr<ExtraBlock>;
|
2019-09-09 19:43:37 +00:00
|
|
|
|
2021-03-25 18:11:54 +00:00
|
|
|
class TableJoin;
|
2021-08-17 13:30:01 +00:00
|
|
|
class NotJoinedBlocks;
|
2021-03-25 18:11:54 +00:00
|
|
|
|
2019-09-09 19:43:37 +00:00
|
|
|
class IJoin
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual ~IJoin() = default;
|
|
|
|
|
2021-03-25 18:11:54 +00:00
|
|
|
virtual const TableJoin & getTableJoin() const = 0;
|
|
|
|
|
2019-09-09 19:43:37 +00:00
|
|
|
/// Add block of data from right hand of JOIN.
|
|
|
|
/// @returns false, if some limit was exceeded and you should not insert more data.
|
2022-03-13 11:59:20 +00:00
|
|
|
virtual bool addJoinedBlock(const Block & block, bool check_limits = true) = 0; /// NOLINT
|
2019-09-09 19:43:37 +00:00
|
|
|
|
2021-09-13 13:35:17 +00:00
|
|
|
virtual void checkTypesOfKeys(const Block & block) const = 0;
|
|
|
|
|
2019-09-09 19:43:37 +00:00
|
|
|
/// Join the block with data from left hand of JOIN to the right hand data (that was previously built by calls to addJoinedBlock).
|
|
|
|
/// Could be called from different threads in parallel.
|
2020-01-15 20:33:29 +00:00
|
|
|
virtual void joinBlock(Block & block, std::shared_ptr<ExtraBlock> & not_processed) = 0;
|
2019-09-09 19:43:37 +00:00
|
|
|
|
2021-07-14 10:02:23 +00:00
|
|
|
/// Set/Get totals for right table
|
2019-09-09 19:43:37 +00:00
|
|
|
virtual void setTotals(const Block & block) = 0;
|
2021-07-14 10:02:23 +00:00
|
|
|
virtual const Block & getTotals() const = 0;
|
2019-09-09 19:43:37 +00:00
|
|
|
|
2019-09-10 14:51:28 +00:00
|
|
|
virtual size_t getTotalRowCount() const = 0;
|
2020-02-17 17:08:31 +00:00
|
|
|
virtual size_t getTotalByteCount() const = 0;
|
2021-08-03 09:34:08 +00:00
|
|
|
virtual bool alwaysReturnsEmptySet() const = 0;
|
2019-09-16 12:37:46 +00:00
|
|
|
|
2021-04-29 09:08:49 +00:00
|
|
|
/// StorageJoin/Dictionary is already filled. No need to call addJoinedBlock.
|
|
|
|
/// Different query plan is used for such joins.
|
|
|
|
virtual bool isFilled() const { return false; }
|
2021-04-28 17:32:12 +00:00
|
|
|
|
2022-04-19 08:07:30 +00:00
|
|
|
// That can run FillingRightJoinSideTransform parallelly
|
|
|
|
virtual bool supportParallelJoin() const { return false; }
|
|
|
|
|
2021-09-10 14:52:44 +00:00
|
|
|
virtual std::shared_ptr<NotJoinedBlocks>
|
|
|
|
getNonJoinedBlocks(const Block & left_sample_block, const Block & result_sample_block, UInt64 max_block_size) const = 0;
|
2019-09-09 19:43:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
using JoinPtr = std::shared_ptr<IJoin>;
|
|
|
|
|
2019-09-11 18:03:21 +00:00
|
|
|
}
|