ClickHouse/src/Interpreters/IJoin.h

50 lines
1.4 KiB
C++
Raw Normal View History

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>
#include <Columns/IColumn.h>
#include <DataStreams/IBlockStream_fwd.h>
2019-09-09 19:43:37 +00:00
namespace DB
{
class Block;
2020-01-15 20:33:29 +00:00
struct ExtraBlock;
using ExtraBlockPtr = std::shared_ptr<ExtraBlock>;
2019-09-09 19:43:37 +00:00
class TableJoin;
2019-09-09 19:43:37 +00:00
class IJoin
{
public:
virtual ~IJoin() = default;
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.
virtual bool addJoinedBlock(const Block & block, bool check_limits = true) = 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
2019-09-23 14:37:42 +00:00
virtual bool hasTotals() const = 0;
/// Set totals for right table
2019-09-09 19:43:37 +00:00
virtual void setTotals(const Block & block) = 0;
/// Add totals to block from left table
2019-09-09 19:43:37 +00:00
virtual void joinTotals(Block & block) const = 0;
2019-09-10 14:51:28 +00:00
virtual size_t getTotalRowCount() const = 0;
virtual size_t getTotalByteCount() const = 0;
2019-10-11 17:27:54 +00:00
virtual bool alwaysReturnsEmptySet() const { return false; }
virtual BlockInputStreamPtr createStreamWithNonJoinedRows(const Block &, UInt64) const { return {}; }
2019-09-09 19:43:37 +00:00
};
using JoinPtr = std::shared_ptr<IJoin>;
2019-09-11 18:03:21 +00:00
}