mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
stash
This commit is contained in:
parent
fec6d366e5
commit
e8585a3740
@ -225,8 +225,7 @@ bool ConcurrentHashJoin::addBlockToJoin(const Block & right_block_, bool check_l
|
||||
|
||||
void ConcurrentHashJoin::joinBlock(Block & block, std::shared_ptr<ExtraBlock> & /*not_processed*/)
|
||||
{
|
||||
if (hash_joins[0]->data->getKind() == JoinKind::Right || hash_joins[0]->data->getKind() == JoinKind::Full)
|
||||
materializeBlockInplace(block);
|
||||
hash_joins[0]->data->materializeColumnsFromLeftBlock(block);
|
||||
|
||||
auto dispatched_blocks = dispatchBlock(table_join->getOnlyClause().key_names_left, block);
|
||||
block = {};
|
||||
|
@ -446,6 +446,18 @@ void HashJoin::initRightBlockStructure(Block & saved_block_sample)
|
||||
}
|
||||
}
|
||||
|
||||
void HashJoin::materializeColumnsFromLeftBlock(Block & block) const
|
||||
{
|
||||
/** If you use FULL or RIGHT JOIN, then the columns from the "left" table must be materialized.
|
||||
* Because if they are constants, then in the "not joined" rows, they may have different values
|
||||
* - default values, which can differ from the values of these constants.
|
||||
*/
|
||||
if (kind == JoinKind::Right || kind == JoinKind::Full)
|
||||
{
|
||||
materializeBlockInplace(block);
|
||||
}
|
||||
}
|
||||
|
||||
Block HashJoin::materializeColumnsFromRightBlock(Block block) const
|
||||
{
|
||||
return DB::materializeColumnsFromRightBlock(std::move(block), savedBlockSample(), table_join->getAllNames(JoinTableSide::Right));
|
||||
@ -943,10 +955,7 @@ void HashJoin::joinBlock(Block & block, ExtraBlockPtr & not_processed)
|
||||
return;
|
||||
}
|
||||
|
||||
if (kind == JoinKind::Right || kind == JoinKind::Full)
|
||||
{
|
||||
materializeBlockInplace(block);
|
||||
}
|
||||
materializeColumnsFromLeftBlock(block);
|
||||
|
||||
{
|
||||
std::vector<const std::decay_t<decltype(data->maps[0])> * > maps_vector;
|
||||
|
@ -526,6 +526,7 @@ public:
|
||||
|
||||
void setMaxJoinedBlockRows(size_t value) { max_joined_block_rows = value; }
|
||||
|
||||
void materializeColumnsFromLeftBlock(Block & block) const;
|
||||
Block materializeColumnsFromRightBlock(Block block) const;
|
||||
|
||||
private:
|
||||
|
@ -140,15 +140,6 @@ public:
|
||||
auto & source_block = block.getSourceBlock();
|
||||
size_t existing_columns = source_block.columns();
|
||||
|
||||
/** If you use FULL or RIGHT JOIN, then the columns from the "left" table must be materialized.
|
||||
* Because if they are constants, then in the "not joined" rows, they may have different values
|
||||
* - default values, which can differ from the values of these constants.
|
||||
*/
|
||||
if constexpr (join_features.right || join_features.full)
|
||||
{
|
||||
materializeBlockInplace(source_block);
|
||||
}
|
||||
|
||||
/** For LEFT/INNER JOIN, the saved blocks do not contain keys.
|
||||
* For FULL/RIGHT JOIN, the saved blocks contain keys;
|
||||
* but they will not be used at this stage of joining (and will be in `AdderNonJoined`), and they need to be skipped.
|
||||
|
Loading…
Reference in New Issue
Block a user