2022-03-21 11:54:32 +00:00
|
|
|
#pragma once
|
|
|
|
|
2022-07-04 13:19:46 +00:00
|
|
|
#include <Common/logger_useful.h>
|
2022-03-21 11:54:32 +00:00
|
|
|
|
|
|
|
#include <Core/Block.h>
|
|
|
|
|
|
|
|
#include <Interpreters/IJoin.h>
|
|
|
|
#include <Interpreters/TableJoin.h>
|
|
|
|
|
|
|
|
#include <QueryPipeline/SizeLimits.h>
|
|
|
|
|
2022-08-04 15:39:28 +00:00
|
|
|
#include <Interpreters/IKeyValueEntity.h>
|
2022-03-21 11:54:32 +00:00
|
|
|
#include <Storages/IStorage_fwd.h>
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
|
|
|
class NotJoinedBlocks;
|
|
|
|
|
|
|
|
class DirectKeyValueJoin : public IJoin
|
|
|
|
{
|
|
|
|
public:
|
2022-07-04 17:10:34 +00:00
|
|
|
DirectKeyValueJoin(
|
|
|
|
std::shared_ptr<TableJoin> table_join_,
|
|
|
|
const Block & right_sample_block_,
|
2022-08-08 10:58:28 +00:00
|
|
|
std::shared_ptr<const IKeyValueEntity> storage_);
|
2022-03-21 11:54:32 +00:00
|
|
|
|
2022-09-28 11:20:24 +00:00
|
|
|
DirectKeyValueJoin(
|
|
|
|
std::shared_ptr<TableJoin> table_join_,
|
|
|
|
const Block & right_sample_block_,
|
|
|
|
std::shared_ptr<const IKeyValueEntity> storage_,
|
|
|
|
const Block & right_sample_block_with_storage_column_names_);
|
|
|
|
|
2022-03-21 11:54:32 +00:00
|
|
|
virtual const TableJoin & getTableJoin() const override { return *table_join; }
|
|
|
|
|
2022-03-21 15:35:47 +00:00
|
|
|
virtual bool addJoinedBlock(const Block &, bool) override;
|
|
|
|
virtual void checkTypesOfKeys(const Block &) const override;
|
2022-03-21 11:54:32 +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.
|
|
|
|
virtual void joinBlock(Block & block, std::shared_ptr<ExtraBlock> &) override;
|
|
|
|
|
2022-03-21 15:35:47 +00:00
|
|
|
virtual size_t getTotalRowCount() const override { return 0; }
|
2022-03-21 11:54:32 +00:00
|
|
|
|
2022-03-21 15:35:47 +00:00
|
|
|
virtual size_t getTotalByteCount() const override { return 0; }
|
2022-03-21 11:54:32 +00:00
|
|
|
|
|
|
|
virtual bool alwaysReturnsEmptySet() const override { return false; }
|
|
|
|
|
|
|
|
virtual bool isFilled() const override { return true; }
|
|
|
|
|
2022-10-18 11:43:01 +00:00
|
|
|
virtual IBlocksStreamPtr
|
2022-03-21 11:54:32 +00:00
|
|
|
getNonJoinedBlocks(const Block &, const Block &, UInt64) const override
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
std::shared_ptr<TableJoin> table_join;
|
2022-08-08 10:58:28 +00:00
|
|
|
std::shared_ptr<const IKeyValueEntity> storage;
|
2022-03-21 11:54:32 +00:00
|
|
|
Block right_sample_block;
|
2022-09-28 11:20:24 +00:00
|
|
|
Block right_sample_block_with_storage_column_names;
|
2022-03-21 11:54:32 +00:00
|
|
|
Block sample_block_with_columns_to_add;
|
|
|
|
Poco::Logger * log;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|