#pragma once
#include
#include
#include
#include
#include
#include
#include
namespace DB
{
class NotJoinedBlocks;
class DirectKeyValueJoin : public IJoin
{
public:
DirectKeyValueJoin(std::shared_ptr table_join_, const Block & right_sample_block_, std::shared_ptr storage_)
: table_join(table_join_)
, storage(storage_)
, right_sample_block(right_sample_block_)
, log(&Poco::Logger::get("DirectKeyValueJoin"))
{
LOG_TRACE(log, "Using direct join");
}
virtual const TableJoin & getTableJoin() const override { return *table_join; }
virtual bool addJoinedBlock(const Block &, bool) override
{
throw DB::Exception(ErrorCodes::LOGICAL_ERROR, "not implemented");
}
virtual void checkTypesOfKeys(const Block &) const override
{
// throw DB::Exception(ErrorCodes::LOGICAL_ERROR, "not implemented");
}
/// 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 &) override;
virtual size_t getTotalRowCount() const override
{
return 0;
}
virtual size_t getTotalByteCount() const override
{
return 0;
}
virtual bool alwaysReturnsEmptySet() const override { return false; }
virtual bool isFilled() const override { return true; }
virtual std::shared_ptr
getNonJoinedBlocks(const Block &, const Block &, UInt64) const override
{
return nullptr;
}
private:
std::shared_ptr table_join;
std::shared_ptr storage;
Block right_sample_block;
Block sample_block_with_columns_to_add;
Poco::Logger * log;
};
}