mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 15:12:02 +00:00
commit
f0845eeacb
@ -1157,8 +1157,7 @@ void WindowTransform::appendChunk(Chunk & chunk)
|
||||
// Initialize output columns.
|
||||
for (auto & ws : workspaces)
|
||||
{
|
||||
if (ws.window_function_impl)
|
||||
block.casted_columns.push_back(ws.window_function_impl->castColumn(block.input_columns, ws.argument_column_indices));
|
||||
block.casted_columns.push_back(ws.window_function_impl ? ws.window_function_impl->castColumn(block.input_columns, ws.argument_column_indices) : nullptr);
|
||||
|
||||
block.output_columns.push_back(ws.aggregate_function->getResultType()
|
||||
->createColumn());
|
||||
|
@ -38,3 +38,19 @@
|
||||
7
|
||||
8
|
||||
9
|
||||
15 \N 3 15 15 15 15
|
||||
14 \N 2 10 10 10 154
|
||||
13 \N 2 10 10 10 143
|
||||
12 \N 2 10 10 10 14
|
||||
11 \N 2 10 10 10 12
|
||||
10 \N 2 10 10 10 10
|
||||
9 \N 1 5 5 5 99
|
||||
8 \N 1 5 5 5 88
|
||||
7 \N 1 5 5 5 9
|
||||
6 \N 1 5 5 5 7
|
||||
5 \N 1 5 5 5 5
|
||||
4 \N 0 0 0 0 44
|
||||
3 \N 0 0 0 0 33
|
||||
2 \N 0 0 0 0 4
|
||||
1 \N 0 0 0 0 2
|
||||
0 \N 0 0 0 0 0
|
||||
|
@ -2,3 +2,23 @@ SELECT lagInFrame(2::UInt128, 2, number) OVER w FROM numbers(10) WINDOW w AS (OR
|
||||
SELECT leadInFrame(2::UInt128, 2, number) OVER w FROM numbers(10) WINDOW w AS (ORDER BY number);
|
||||
SELECT lagInFrame(2::UInt64, 2, number) OVER w FROM numbers(10) WINDOW w AS (ORDER BY number);
|
||||
SELECT leadInFrame(2::UInt64, 2, number) OVER w FROM numbers(10) WINDOW w AS (ORDER BY number);
|
||||
|
||||
SELECT
|
||||
number,
|
||||
YYYYMMDDToDate(1, toLowCardinality(11), max(YYYYMMDDToDate(YYYYMMDDToDate(toLowCardinality(1), 11, materialize(NULL), 19700101.1, 1, 27, 7, materialize(toUInt256(37)), 9, 19, 9), 1, toUInt128(11), NULL, 19700101.1, 1, 27, 7, 37, 9, 19, 9), toUInt256(30)) IGNORE NULLS OVER w, NULL, 19700101.1, toNullable(1), 27, materialize(7), 37, 9, 19, 9),
|
||||
p,
|
||||
pp,
|
||||
lagInFrame(number, number - pp) OVER w AS lag2,
|
||||
lagInFrame(number, number - pp, number * 11) OVER w AS lag,
|
||||
leadInFrame(number, number - pp, number * 11) OVER w AS lead
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
number,
|
||||
intDiv(number, 5) AS p,
|
||||
p * 5 AS pp
|
||||
FROM numbers(16)
|
||||
)
|
||||
WHERE toLowCardinality(1)
|
||||
WINDOW w AS (PARTITION BY p ORDER BY number ASC NULLS FIRST ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)
|
||||
ORDER BY number DESC NULLS LAST;
|
||||
|
Loading…
Reference in New Issue
Block a user