mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-29 02:52:13 +00:00
Allow several functions in window expression
This commit is contained in:
parent
5d2f1b7a2d
commit
eddd4ecaeb
@ -16,7 +16,10 @@ struct WindowFunctionsUtils
|
||||
for (auto const & child : node->arguments->children)
|
||||
{
|
||||
if (const auto * child_node = child->as<ASTFunction>())
|
||||
window_function_added = window_function_added || collectWindowFunctionsFromExpression(child_node, function_list);
|
||||
{
|
||||
bool added_in_subtree = collectWindowFunctionsFromExpression(child_node, function_list);
|
||||
window_function_added = window_function_added || added_in_subtree;
|
||||
}
|
||||
}
|
||||
if (!window_function_added && AggregateUtils::isAggregateFunction(*node))
|
||||
{
|
||||
|
@ -116,3 +116,109 @@ ORDER BY x;
|
||||
521
|
||||
531
|
||||
541
|
||||
SELECT
|
||||
number,
|
||||
sum(number) / count() OVER (PARTITION BY number % 10),
|
||||
avg(number) OVER (PARTITION BY number % 10)
|
||||
FROM numbers(100)
|
||||
ORDER BY number ASC;
|
||||
0 45 45
|
||||
1 46 46
|
||||
2 47 47
|
||||
3 48 48
|
||||
4 49 49
|
||||
5 50 50
|
||||
6 51 51
|
||||
7 52 52
|
||||
8 53 53
|
||||
9 54 54
|
||||
10 45 45
|
||||
11 46 46
|
||||
12 47 47
|
||||
13 48 48
|
||||
14 49 49
|
||||
15 50 50
|
||||
16 51 51
|
||||
17 52 52
|
||||
18 53 53
|
||||
19 54 54
|
||||
20 45 45
|
||||
21 46 46
|
||||
22 47 47
|
||||
23 48 48
|
||||
24 49 49
|
||||
25 50 50
|
||||
26 51 51
|
||||
27 52 52
|
||||
28 53 53
|
||||
29 54 54
|
||||
30 45 45
|
||||
31 46 46
|
||||
32 47 47
|
||||
33 48 48
|
||||
34 49 49
|
||||
35 50 50
|
||||
36 51 51
|
||||
37 52 52
|
||||
38 53 53
|
||||
39 54 54
|
||||
40 45 45
|
||||
41 46 46
|
||||
42 47 47
|
||||
43 48 48
|
||||
44 49 49
|
||||
45 50 50
|
||||
46 51 51
|
||||
47 52 52
|
||||
48 53 53
|
||||
49 54 54
|
||||
50 45 45
|
||||
51 46 46
|
||||
52 47 47
|
||||
53 48 48
|
||||
54 49 49
|
||||
55 50 50
|
||||
56 51 51
|
||||
57 52 52
|
||||
58 53 53
|
||||
59 54 54
|
||||
60 45 45
|
||||
61 46 46
|
||||
62 47 47
|
||||
63 48 48
|
||||
64 49 49
|
||||
65 50 50
|
||||
66 51 51
|
||||
67 52 52
|
||||
68 53 53
|
||||
69 54 54
|
||||
70 45 45
|
||||
71 46 46
|
||||
72 47 47
|
||||
73 48 48
|
||||
74 49 49
|
||||
75 50 50
|
||||
76 51 51
|
||||
77 52 52
|
||||
78 53 53
|
||||
79 54 54
|
||||
80 45 45
|
||||
81 46 46
|
||||
82 47 47
|
||||
83 48 48
|
||||
84 49 49
|
||||
85 50 50
|
||||
86 51 51
|
||||
87 52 52
|
||||
88 53 53
|
||||
89 54 54
|
||||
90 45 45
|
||||
91 46 46
|
||||
92 47 47
|
||||
93 48 48
|
||||
94 49 49
|
||||
95 50 50
|
||||
96 51 51
|
||||
97 52 52
|
||||
98 53 53
|
||||
99 54 54
|
||||
|
@ -7,3 +7,10 @@ SELECT sum(number) + 1 AS x
|
||||
FROM numbers(100)
|
||||
GROUP BY number % 10
|
||||
ORDER BY x;
|
||||
|
||||
SELECT
|
||||
number,
|
||||
sum(number) / count() OVER (PARTITION BY number % 10),
|
||||
avg(number) OVER (PARTITION BY number % 10)
|
||||
FROM numbers(100)
|
||||
ORDER BY number ASC;
|
||||
|
Loading…
Reference in New Issue
Block a user