CURRENT ROW frame start for ROWS frame

This commit is contained in:
Alexander Kuzmenkov 2021-02-02 02:11:40 +03:00
parent ef46c36317
commit 78a9624fc5
3 changed files with 16 additions and 4 deletions

View File

@ -285,6 +285,19 @@ void WindowTransform::advanceFrameStartChoose()
// the new partition starts.
frame_started = true;
return;
case WindowFrame::BoundaryType::Current:
switch (window_description.frame.type)
{
case WindowFrame::FrameType::Rows:
// CURRENT ROW
frame_start = current_row;
frame_started = true;
return;
default:
// Fallthrough to the "not implemented" error.
break;
}
break;
case WindowFrame::BoundaryType::Offset:
switch (window_description.frame.type)
{
@ -296,9 +309,6 @@ void WindowTransform::advanceFrameStartChoose()
break;
}
break;
default:
// Fallthrough to the "not implemented" error.
break;
}
throw Exception(ErrorCodes::NOT_IMPLEMENTED,

View File

@ -516,7 +516,7 @@ settings max_block_size = 2;
27 27 29 29
27 27 29 29
30 30 30 30
-- ROWS offset frame start
-- CURRENT ROW and offset for ROWS frame start
select number, p,
count(*) over (partition by p order by number
rows between 1 preceding and unbounded following),

View File

@ -167,6 +167,8 @@ settings max_block_size = 2;
select number, p,
count(*) over (partition by p order by number
rows between 1 preceding and unbounded following),
count(*) over (partition by p order by number
rows between current row and unbounded following),
count(*) over (partition by p order by number
rows between 1 following and unbounded following)
from (select number, intDiv(number, 5) p from numbers(31))