This commit is contained in:
Alexander Kuzmenkov 2021-05-27 21:39:06 +03:00
parent 1c6479a7d9
commit 9fc51aef68
3 changed files with 7 additions and 2 deletions

View File

@ -92,8 +92,10 @@ AggregateFunctionPtr AggregateFunctionFactory::get(
// Pure window functions are not real aggregate functions. Applying
// combinators doesn't make sense for them, they must handle the
// nullability themselves.
if (nested_function->asWindowFunction())
// nullability themselves. Another special case is functions from Nothing
// that are rewritten to AggregateFunctionNothing, in this case
// nested_function is nullptr.
if (nested_function && nested_function->asWindowFunction())
{
return nested_function;
}

View File

@ -1058,6 +1058,8 @@ settings max_block_size = 3;
select lagInFrame(toNullable(1)) over ();
0
select lagInFrameOrNull(1) over (); -- { serverError 36 }
select intDiv(1, NULL) x, toTypeName(x), max(x) over ();
\N Nullable(Nothing) \N
-- case-insensitive SQL-standard synonyms for any and anyLast
select
number,

View File

@ -379,6 +379,7 @@ settings max_block_size = 3;
-- careful with auto-application of Null combinator
select lagInFrame(toNullable(1)) over ();
select lagInFrameOrNull(1) over (); -- { serverError 36 }
select intDiv(1, NULL) x, toTypeName(x), max(x) over ();
-- case-insensitive SQL-standard synonyms for any and anyLast
select