mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-22 23:52:03 +00:00
Merge pull request #48998 from ongkong/fix-join-clause-create-column
Fix incorrect createColumn call on join clause
This commit is contained in:
commit
1267fbca1c
@ -1066,13 +1066,6 @@ static std::shared_ptr<IJoin> chooseJoinAlgorithm(
|
||||
{
|
||||
const auto & settings = context->getSettings();
|
||||
|
||||
Block left_sample_block(left_sample_columns);
|
||||
for (auto & column : left_sample_block)
|
||||
{
|
||||
if (!column.column)
|
||||
column.column = column.type->createColumn();
|
||||
}
|
||||
|
||||
Block right_sample_block = joined_plan->getCurrentDataStream().header;
|
||||
|
||||
std::vector<String> tried_algorithms;
|
||||
@ -1118,7 +1111,10 @@ static std::shared_ptr<IJoin> chooseJoinAlgorithm(
|
||||
if (analyzed_join->isEnabledAlgorithm(JoinAlgorithm::GRACE_HASH))
|
||||
{
|
||||
tried_algorithms.push_back(toString(JoinAlgorithm::GRACE_HASH));
|
||||
if (GraceHashJoin::isSupported(analyzed_join))
|
||||
|
||||
// Grace hash join requires that columns exist in left_sample_block.
|
||||
Block left_sample_block(left_sample_columns);
|
||||
if (sanitizeBlock(left_sample_block, false) && GraceHashJoin::isSupported(analyzed_join))
|
||||
return std::make_shared<GraceHashJoin>(context, analyzed_join, left_sample_block, right_sample_block, context->getTempDataOnDisk());
|
||||
}
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
1
|
@ -0,0 +1,8 @@
|
||||
select count(*)
|
||||
from (
|
||||
select 1 as id, [1, 2, 3] as arr
|
||||
) as sessions
|
||||
ASOF LEFT JOIN (
|
||||
select 1 as session_id, 4 as id
|
||||
) as visitors
|
||||
ON visitors.session_id <= sessions.id AND arrayFirst(a -> a, arrayMap((a) -> a, sessions.arr)) = visitors.id
|
Loading…
Reference in New Issue
Block a user