This commit is contained in:
Sergey Skvortsov 2022-06-11 14:03:44 +03:00
parent 43b15e4c65
commit a211b7f360
4 changed files with 34 additions and 2 deletions

View File

@ -1,6 +1,22 @@
#include <Interpreters/GraceHashJoin.h>
#include <Interpreters/HashJoin.h>
namespace DB
{
GraceHashJoin::GraceHashJoin(std::shared_ptr<TableJoin> table_join, const Block & right_sample_block, bool any_take_last_row)
: first_bucket{std::make_shared<HashJoin>(table_join, right_sample_block, any_take_last_row)}
{
}
bool GraceHashJoin::addJoinedBlock(const Block & block, bool check_limits) {
}
void GraceHashJoin::checkTypesOfKeys(const Block & block) const {
return first_bucket->checkTypesOfKeys(block);
}
void GraceHashJoin::joinBlock(Block & block, std::shared_ptr<ExtraBlock> & not_processed) {
}
}

View File

@ -10,9 +10,9 @@ class TableJoin;
class GraceHashJoin final : public IJoin
{
public:
GraceHashJoin(std::shared_ptr<TableJoin> table_join, const Block & right_sample_block, bool any_take_las_row_ = false);
GraceHashJoin(std::shared_ptr<TableJoin> table_join, const Block & right_sample_block, bool any_take_last_row);
const TableJoin & getTableJoin() const override;
const TableJoin & getTableJoin() const override { return *table_join; }
bool addJoinedBlock(const Block & block, bool check_limits) override;
void checkTypesOfKeys(const Block & block) const override;
@ -33,6 +33,7 @@ private:
Block totals;
JoinPtr first_bucket;
std::vector<std::string> file_buckets;
};
}

View File

@ -573,6 +573,19 @@ void splitAdditionalColumns(const Names & key_names, const Block & sample_block,
}
}
template <std::integral T>
static bool isPowerOf2(T number) {
// TODO(sskvor)
return false;
}
Blocks scatterBlockByHash(const Strings& key_columns_names, const Block& block, size_t num_shards) {
if (likely(isPowerOf2(num_shards))) {
return scatterBlockByHashLog2(key_columns_names, block, num_shards_log2);
}
return scatterBlockByHashImpl(key_columns_names, )
}
}
NotJoinedBlocks::NotJoinedBlocks(std::unique_ptr<RightColumnsFiller> filler_,

View File

@ -106,6 +106,8 @@ void splitAdditionalColumns(const Names & key_names, const Block & sample_block,
void changeLowCardinalityInplace(ColumnWithTypeAndName & column);
Blocks scatterBlockByHash(const Strings& key_columns_names, const Block& block, size_t num_shards);
}
/// Creates result from right table data in RIGHT and FULL JOIN when keys are not present in left table.