1#pragma once
2
3#include <memory>
4#include <vector>
5
6#include <Core/Names.h>
7#include <Columns/IColumn.h>
8#include <DataStreams/IBlockStream_fwd.h>
9
10namespace DB
11{
12
13class Block;
14
15class IJoin
16{
17public:
18 virtual ~IJoin() = default;
19
20 /// Add block of data from right hand of JOIN.
21 /// @returns false, if some limit was exceeded and you should not insert more data.
22 virtual bool addJoinedBlock(const Block & block) = 0;
23
24 /// Join the block with data from left hand of JOIN to the right hand data (that was previously built by calls to addJoinedBlock).
25 /// Could be called from different threads in parallel.
26 virtual void joinBlock(Block & block) = 0;
27
28 virtual bool hasTotals() const = 0;
29 virtual void setTotals(const Block & block) = 0;
30 virtual void joinTotals(Block & block) const = 0;
31
32 virtual size_t getTotalRowCount() const = 0;
33 virtual bool alwaysReturnsEmptySet() const { return false; }
34
35 virtual BlockInputStreamPtr createStreamWithNonJoinedRows(const Block &, UInt64) const { return {}; }
36 virtual bool hasStreamWithNonJoinedRows() const { return false; }
37};
38
39using JoinPtr = std::shared_ptr<IJoin>;
40
41}
42