mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
dbms: fixed error when sorting result of ARRAY JOIN by empty arrays [#METR-13204].
This commit is contained in:
parent
5fc32bb267
commit
1c16466214
@ -47,16 +47,23 @@ Block MergeSortingBlockInputStream::merge(Blocks & blocks)
|
||||
|
||||
bool has_collation = false;
|
||||
|
||||
size_t i = 0;
|
||||
for (Blocks::const_iterator it = blocks.begin(); it != blocks.end(); ++it, ++i)
|
||||
size_t nonempty_blocks = 0;
|
||||
for (Blocks::const_iterator it = blocks.begin(); it != blocks.end(); ++it)
|
||||
{
|
||||
if (!*it)
|
||||
if (it->rowsInFirstColumn() == 0)
|
||||
continue;
|
||||
|
||||
cursors[i] = SortCursorImpl(*it, description);
|
||||
has_collation |= cursors[i].has_collation;
|
||||
cursors[nonempty_blocks] = SortCursorImpl(*it, description);
|
||||
has_collation |= cursors[nonempty_blocks].has_collation;
|
||||
|
||||
++nonempty_blocks;
|
||||
}
|
||||
|
||||
if (nonempty_blocks == 0)
|
||||
return Block();
|
||||
|
||||
cursors.resize(nonempty_blocks);
|
||||
|
||||
Block merged;
|
||||
|
||||
if (has_collation)
|
||||
|
@ -22,7 +22,7 @@ void MergingSortedBlockInputStream::init(Block & merged_block, ColumnPlainPtrs &
|
||||
|
||||
*it = children[i]->read();
|
||||
|
||||
if (!*it)
|
||||
if (it->rowsInFirstColumn() == 0)
|
||||
continue;
|
||||
|
||||
if (!num_columns)
|
||||
|
@ -0,0 +1,2 @@
|
||||
SET max_block_size = 1;
|
||||
SELECT number, arr FROM (SELECT number, arrayFilter(x -> x = 0, [1]) AS arr FROM system.numbers LIMIT 10) ARRAY JOIN arr ORDER BY number;
|
Loading…
Reference in New Issue
Block a user