mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 09:32:06 +00:00
Merge pull request #39014 from vdimir/fsj-fix
Fix assertion in full soring merge join
This commit is contained in:
commit
06ce3e0b2e
@ -320,14 +320,10 @@ static void prepareChunk(Chunk & chunk)
|
||||
void MergeJoinAlgorithm::initialize(Inputs inputs)
|
||||
{
|
||||
if (inputs.size() != 2)
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Two inputs arerequired, got {}", inputs.size());
|
||||
throw Exception(ErrorCodes::LOGICAL_ERROR, "Two inputs are required, got {}", inputs.size());
|
||||
|
||||
LOG_DEBUG(log, "Initialize, number of inputs: {}", inputs.size());
|
||||
for (size_t i = 0; i < inputs.size(); ++i)
|
||||
{
|
||||
assert(inputs[i].chunk.getNumColumns() == cursors[i]->sampleBlock().columns());
|
||||
prepareChunk(inputs[i].chunk);
|
||||
copyColumnsResized(inputs[i].chunk.getColumns(), 0, 0, sample_chunks.emplace_back());
|
||||
consume(inputs[i], i);
|
||||
}
|
||||
}
|
||||
@ -476,7 +472,7 @@ std::optional<MergeJoinAlgorithm::Status> MergeJoinAlgorithm::handleAllJoinState
|
||||
MutableColumns result_cols;
|
||||
for (size_t i = 0; i < 2; ++i)
|
||||
{
|
||||
for (const auto & col : sample_chunks[i].getColumns())
|
||||
for (const auto & col : cursors[i]->sampleColumns())
|
||||
result_cols.push_back(col->cloneEmpty());
|
||||
}
|
||||
|
||||
@ -750,8 +746,8 @@ Chunk MergeJoinAlgorithm::createBlockWithDefaults(size_t source_num, size_t star
|
||||
{
|
||||
ColumnRawPtrs cols;
|
||||
{
|
||||
const auto & columns_left = source_num == 0 ? cursors[0]->getCurrent().getColumns() : sample_chunks[0].getColumns();
|
||||
const auto & columns_right = source_num == 1 ? cursors[1]->getCurrent().getColumns() : sample_chunks[1].getColumns();
|
||||
const auto & columns_left = source_num == 0 ? cursors[0]->getCurrent().getColumns() : cursors[0]->sampleColumns();
|
||||
const auto & columns_right = source_num == 1 ? cursors[1]->getCurrent().getColumns() : cursors[1]->sampleColumns();
|
||||
|
||||
for (size_t i = 0; i < columns_left.size(); ++i)
|
||||
{
|
||||
|
@ -210,6 +210,7 @@ public:
|
||||
SortCursorImpl cursor;
|
||||
|
||||
const Block & sampleBlock() const { return sample_block; }
|
||||
Columns sampleColumns() const { return sample_block.getColumns(); }
|
||||
|
||||
private:
|
||||
Block sample_block;
|
||||
@ -261,7 +262,6 @@ private:
|
||||
std::unordered_map<size_t, size_t> left_to_right_key_remap;
|
||||
|
||||
std::vector<FullMergeJoinCursorPtr> cursors;
|
||||
std::vector<Chunk> sample_chunks;
|
||||
|
||||
/// Keep some state to make connection between data in different blocks
|
||||
AnyJoinState any_join_state;
|
||||
|
@ -10,3 +10,5 @@ a a
|
||||
a a
|
||||
a a
|
||||
a a
|
||||
1
|
||||
1
|
||||
|
@ -19,3 +19,6 @@ SELECT * FROM (SELECT 'a' :: LowCardinality(Nullable(String)) AS key) AS t1 JOIN
|
||||
SELECT * FROM (SELECT 'a' :: LowCardinality(Nullable(String)) AS key) AS t1 JOIN (SELECT 'a' :: Nullable(String) AS key) AS t2 ON t1.key = t2.key;
|
||||
|
||||
SELECT * FROM (SELECT 'a' :: LowCardinality(String) AS key) AS t1 JOIN (SELECT 'a' :: LowCardinality(String) AS key) AS t2 ON t1.key = t2.key;
|
||||
|
||||
SELECT 5 == count() FROM (SELECT number as a from numbers(5)) as t1 LEFT JOIN (SELECT number as b from numbers(5) WHERE number > 100) as t2 ON t1.a = t2.b;
|
||||
SELECT 5 == count() FROM (SELECT number as a from numbers(5) WHERE number > 100) as t1 RIGHT JOIN (SELECT number as b from numbers(5)) as t2 ON t1.a = t2.b;
|
||||
|
Loading…
Reference in New Issue
Block a user