ignore empty input chunks generated by joins

This commit is contained in:
Alexander Kuzmenkov 2021-04-23 10:37:47 +03:00
parent fecd5f3435
commit ce0a58f86f
3 changed files with 19 additions and 1 deletions

View File

@ -975,7 +975,14 @@ void WindowTransform::appendChunk(Chunk & chunk)
// have it if it's end of data, though.
if (!input_is_finished)
{
assert(chunk.hasRows());
if (!chunk.hasRows())
{
// Joins may generate empty input chunks when it's not yet end of
// input. Just ignore them. They probably shouldn't be sending empty
// chunks up the pipeline, but oh well.
return;
}
blocks.push_back({});
auto & block = blocks.back();
// Use the number of rows from the Chunk, because it is correct even in

View File

@ -1108,3 +1108,8 @@ from (
-- -INT_MIN row offset that can lead to problems with negation, found when fuzzing
-- under UBSan. Should be limited to at most INT_MAX.
select count() over (rows between 2147483648 preceding and 2147493648 following) from numbers(2); -- { serverError 36 }
-- Somehow in this case WindowTransform gets empty input chunks not marked as
-- input end, and then two (!) empty input chunks marked as input end. Whatever.
select count() over () from (select 1 a) l inner join (select 2 a) r using a;
-- This case works as expected, one empty input chunk marked as input end.
select count() over () where null;

View File

@ -414,3 +414,9 @@ from (
-- -INT_MIN row offset that can lead to problems with negation, found when fuzzing
-- under UBSan. Should be limited to at most INT_MAX.
select count() over (rows between 2147483648 preceding and 2147493648 following) from numbers(2); -- { serverError 36 }
-- Somehow in this case WindowTransform gets empty input chunks not marked as
-- input end, and then two (!) empty input chunks marked as input end. Whatever.
select count() over () from (select 1 a) l inner join (select 2 a) r using a;
-- This case works as expected, one empty input chunk marked as input end.
select count() over () where null;