Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
H
h2database
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
Administrator
h2database
Commits
1a62c12b
提交
1a62c12b
authored
9月 16, 2018
作者:
Evgenij Ryazanov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix aggregates with ORDER BY
上级
c574f36b
显示空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
7 行删除
+12
-7
Aggregate.java
h2/src/main/org/h2/expression/aggregate/Aggregate.java
+5
-0
array-agg.sql
...est/org/h2/test/scripts/functions/aggregate/array-agg.sql
+7
-7
没有找到文件。
h2/src/main/org/h2/expression/aggregate/Aggregate.java
浏览文件 @
1a62c12b
...
@@ -295,6 +295,11 @@ public class Aggregate extends AbstractAggregate {
...
@@ -295,6 +295,11 @@ public class Aggregate extends AbstractAggregate {
if
(
on
!=
null
)
{
if
(
on
!=
null
)
{
on
.
updateAggregate
(
session
,
false
);
on
.
updateAggregate
(
session
,
false
);
}
}
if
(
orderByList
!=
null
)
{
for
(
SelectOrderBy
orderBy
:
orderByList
)
{
orderBy
.
expression
.
updateAggregate
(
session
,
false
);
}
}
if
(
filterCondition
!=
null
)
{
if
(
filterCondition
!=
null
)
{
filterCondition
.
updateAggregate
(
session
,
false
);
filterCondition
.
updateAggregate
(
session
,
false
);
}
}
...
...
h2/src/test/org/h2/test/scripts/functions/aggregate/array-agg.sql
浏览文件 @
1a62c12b
...
@@ -77,7 +77,7 @@ INSERT INTO TEST VALUES (1, 'a'), (2, 'a'), (3, 'b'), (4, 'c'), (5, 'c'), (6, 'c
...
@@ -77,7 +77,7 @@ INSERT INTO TEST VALUES (1, 'a'), (2, 'a'), (3, 'b'), (4, 'c'), (5, 'c'), (6, 'c
SELECT
ARRAY_AGG
(
ID
),
NAME
FROM
TEST
;
SELECT
ARRAY_AGG
(
ID
),
NAME
FROM
TEST
;
>
exception
MUST_GROUP_BY_COLUMN_1
>
exception
MUST_GROUP_BY_COLUMN_1
SELECT
ARRAY_AGG
(
ID
ORDER
BY
ID
),
NAME
FROM
TEST
GROUP
BY
NAME
;
SELECT
ARRAY_AGG
(
ID
ORDER
/**/
BY
ID
),
NAME
FROM
TEST
GROUP
BY
NAME
;
>
ARRAY_AGG
(
ID
ORDER
BY
ID
)
NAME
>
ARRAY_AGG
(
ID
ORDER
BY
ID
)
NAME
>
------------------------- ----
>
------------------------- ----
>
(
1
,
2
)
a
>
(
1
,
2
)
a
...
@@ -85,7 +85,7 @@ SELECT ARRAY_AGG(ID ORDER BY ID), NAME FROM TEST GROUP BY NAME;
...
@@ -85,7 +85,7 @@ SELECT ARRAY_AGG(ID ORDER BY ID), NAME FROM TEST GROUP BY NAME;
>
(
4
,
5
,
6
)
c
>
(
4
,
5
,
6
)
c
>
rows
:
3
>
rows
:
3
SELECT
ARRAY_AGG
(
ID
ORDER
BY
ID
)
OVER
(),
NAME
FROM
TEST
;
SELECT
ARRAY_AGG
(
ID
ORDER
/**/
BY
ID
)
OVER
(),
NAME
FROM
TEST
;
>
ARRAY_AGG
(
ID
ORDER
BY
ID
)
OVER
()
NAME
>
ARRAY_AGG
(
ID
ORDER
BY
ID
)
OVER
()
NAME
>
--------------------------------- ----
>
--------------------------------- ----
>
(
1
,
2
,
3
,
4
,
5
,
6
)
a
>
(
1
,
2
,
3
,
4
,
5
,
6
)
a
...
@@ -96,7 +96,7 @@ SELECT ARRAY_AGG(ID ORDER BY ID) OVER (), NAME FROM TEST;
...
@@ -96,7 +96,7 @@ SELECT ARRAY_AGG(ID ORDER BY ID) OVER (), NAME FROM TEST;
>
(
1
,
2
,
3
,
4
,
5
,
6
)
c
>
(
1
,
2
,
3
,
4
,
5
,
6
)
c
>
rows
:
6
>
rows
:
6
SELECT
ARRAY_AGG
(
ID
ORDER
BY
ID
)
OVER
(
PARTITION
BY
NAME
),
NAME
FROM
TEST
;
SELECT
ARRAY_AGG
(
ID
ORDER
/**/
BY
ID
)
OVER
(
PARTITION
BY
NAME
),
NAME
FROM
TEST
;
>
ARRAY_AGG
(
ID
ORDER
BY
ID
)
OVER
(
PARTITION
BY
NAME
)
NAME
>
ARRAY_AGG
(
ID
ORDER
BY
ID
)
OVER
(
PARTITION
BY
NAME
)
NAME
>
-------------------------------------------------- ----
>
-------------------------------------------------- ----
>
(
1
,
2
)
a
>
(
1
,
2
)
a
...
@@ -107,7 +107,7 @@ SELECT ARRAY_AGG(ID ORDER BY ID) OVER (PARTITION BY NAME), NAME FROM TEST;
...
@@ -107,7 +107,7 @@ SELECT ARRAY_AGG(ID ORDER BY ID) OVER (PARTITION BY NAME), NAME FROM TEST;
>
(
4
,
5
,
6
)
c
>
(
4
,
5
,
6
)
c
>
rows
:
6
>
rows
:
6
SELECT
ARRAY_AGG
(
ID
ORDER
BY
ID
)
FILTER
(
WHERE
ID
<
3
OR
ID
>
4
)
OVER
(
PARTITION
BY
NAME
),
NAME
FROM
TEST
ORDER
BY
NAME
;
SELECT
ARRAY_AGG
(
ID
ORDER
/**/
BY
ID
)
FILTER
(
WHERE
ID
<
3
OR
ID
>
4
)
OVER
(
PARTITION
BY
NAME
),
NAME
FROM
TEST
ORDER
BY
NAME
;
>
ARRAY_AGG
(
ID
ORDER
BY
ID
)
FILTER
(
WHERE
((
ID
<
3
)
OR
(
ID
>
4
)))
OVER
(
PARTITION
BY
NAME
)
NAME
>
ARRAY_AGG
(
ID
ORDER
BY
ID
)
FILTER
(
WHERE
((
ID
<
3
)
OR
(
ID
>
4
)))
OVER
(
PARTITION
BY
NAME
)
NAME
>
---------------------------------------------------------------------------------------- ----
>
---------------------------------------------------------------------------------------- ----
>
(
1
,
2
)
a
>
(
1
,
2
)
a
...
@@ -124,7 +124,7 @@ SELECT ARRAY_AGG(SUM(ID)) OVER () FROM TEST;
...
@@ -124,7 +124,7 @@ SELECT ARRAY_AGG(SUM(ID)) OVER () FROM TEST;
>
(
21
)
>
(
21
)
>
rows
:
1
>
rows
:
1
SELECT
ARRAY_AGG
(
ID
ORDER
BY
ID
)
OVER
()
FROM
TEST
GROUP
BY
ID
;
SELECT
ARRAY_AGG
(
ID
ORDER
/**/
BY
ID
)
OVER
()
FROM
TEST
GROUP
BY
ID
ORDER
/**/
BY
ID
;
>
ARRAY_AGG
(
ID
ORDER
BY
ID
)
OVER
()
>
ARRAY_AGG
(
ID
ORDER
BY
ID
)
OVER
()
>
---------------------------------
>
---------------------------------
>
(
1
,
2
,
3
,
4
,
5
,
6
)
>
(
1
,
2
,
3
,
4
,
5
,
6
)
...
@@ -143,7 +143,7 @@ SELECT ARRAY_AGG(NAME) OVER(PARTITION BY NAME) FROM TEST GROUP BY NAME;
...
@@ -143,7 +143,7 @@ SELECT ARRAY_AGG(NAME) OVER(PARTITION BY NAME) FROM TEST GROUP BY NAME;
>
(
c
)
>
(
c
)
>
rows
:
3
>
rows
:
3
SELECT
ARRAY_AGG
(
ARRAY_AGG
(
ID
ORDER
BY
ID
))
OVER
(
PARTITION
BY
NAME
),
NAME
FROM
TEST
GROUP
BY
NAME
;
SELECT
ARRAY_AGG
(
ARRAY_AGG
(
ID
ORDER
/**/
BY
ID
))
OVER
(
PARTITION
BY
NAME
),
NAME
FROM
TEST
GROUP
BY
NAME
;
>
ARRAY_AGG
(
ARRAY_AGG
(
ID
ORDER
BY
ID
))
OVER
(
PARTITION
BY
NAME
)
NAME
>
ARRAY_AGG
(
ARRAY_AGG
(
ID
ORDER
BY
ID
))
OVER
(
PARTITION
BY
NAME
)
NAME
>
------------------------------------------------------------- ----
>
------------------------------------------------------------- ----
>
((
1
,
2
))
a
>
((
1
,
2
))
a
...
@@ -151,7 +151,7 @@ SELECT ARRAY_AGG(ARRAY_AGG(ID ORDER BY ID)) OVER (PARTITION BY NAME), NAME FROM
...
@@ -151,7 +151,7 @@ SELECT ARRAY_AGG(ARRAY_AGG(ID ORDER BY ID)) OVER (PARTITION BY NAME), NAME FROM
>
((
4
,
5
,
6
))
c
>
((
4
,
5
,
6
))
c
>
rows
:
3
>
rows
:
3
SELECT
ARRAY_AGG
(
ARRAY_AGG
(
ID
ORDER
BY
ID
))
OVER
(
PARTITION
BY
NAME
),
NAME
FROM
TEST
GROUP
BY
NAME
OFFSET
1
ROW
;
SELECT
ARRAY_AGG
(
ARRAY_AGG
(
ID
ORDER
/**/
BY
ID
))
OVER
(
PARTITION
BY
NAME
),
NAME
FROM
TEST
GROUP
BY
NAME
ORDER
/**/
BY
NAME
OFFSET
1
ROW
;
>
ARRAY_AGG
(
ARRAY_AGG
(
ID
ORDER
BY
ID
))
OVER
(
PARTITION
BY
NAME
)
NAME
>
ARRAY_AGG
(
ARRAY_AGG
(
ID
ORDER
BY
ID
))
OVER
(
PARTITION
BY
NAME
)
NAME
>
------------------------------------------------------------- ----
>
------------------------------------------------------------- ----
>
((
3
))
b
>
((
3
))
b
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论