Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
f84308c3
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f84308c3
编写于
3月 07, 2016
作者:
X
Xin Zhang
提交者:
Omer Arap and Xin Zhang
3月 31, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Migrate olap_group tests to ICG [#116156843]
Signed-off-by:
N
Xin Zhang
<
xzhang@pivotal.io
>
上级
b11fc6d5
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
6177 addition
and
0 deletion
+6177
-0
src/test/regress/expected/qp_olap_group.out
src/test/regress/expected/qp_olap_group.out
+6005
-0
src/test/regress/greenplum_schedule
src/test/regress/greenplum_schedule
+3
-0
src/test/regress/sql/olap_setup.sql
src/test/regress/sql/olap_setup.sql
+9
-0
src/test/regress/sql/qp_olap_group.sql
src/test/regress/sql/qp_olap_group.sql
+160
-0
未找到文件。
src/test/regress/expected/qp_olap_group.out
0 → 100644
浏览文件 @
f84308c3
此差异已折叠。
点击以展开。
src/test/regress/greenplum_schedule
浏览文件 @
f84308c3
...
...
@@ -98,6 +98,9 @@ test: qp_dpe qp_subquery qp_functions_idf qp_regexp qp_resource_queue
test: qp_gist_indexes2 qp_gist_indexes3 qp_gist_indexes4
test: olap_setup
test: qp_olap_group
ignore: tpch500GB_orca
# XXX: This test depends on libgpoptudfs library, which includes ORCA helper
...
...
src/test/regress/sql/olap_setup.sql
浏览文件 @
f84308c3
...
...
@@ -2,6 +2,15 @@
-- STANDARD DATA FOR olap_* TESTS.
--
-- start_ignore
drop
table
if
exists
customer
cascade
;
drop
table
if
exists
vendor
cascade
;
drop
table
if
exists
product
cascade
;
drop
table
if
exists
sale
cascade
;
drop
table
if
exists
sale_ord
cascade
;
drop
table
if
exists
util
cascade
;
-- end_ignore
create
table
customer
(
cn
int
not
null
,
...
...
src/test/regress/sql/qp_olap_group.sql
0 → 100644
浏览文件 @
f84308c3
-- ###### Queries involving MIN() function ###### --
SELECT
DISTINCT
sale
.
dt
,
sale
.
qty
,
GROUPING
(
sale
.
dt
,
sale
.
dt
),
GROUP_ID
(),
TO_CHAR
(
COALESCE
(
MIN
(
DISTINCT
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV
(
DISTINCT
floor
(
sale
.
cn
+
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
floor
(
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
DISTINCT
floor
(
sale
.
cn
-
sale
.
vn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
customer
,
product
WHERE
sale
.
cn
=
customer
.
cn
AND
sale
.
pn
=
product
.
pn
GROUP
BY
CUBE
((
sale
.
pn
,
sale
.
pn
),(
sale
.
pn
),(
sale
.
vn
),(
sale
.
cn
,
sale
.
dt
,
sale
.
cn
),(
sale
.
cn
,
sale
.
pn
)),
ROLLUP
((
sale
.
pn
),(
sale
.
qty
,
sale
.
dt
),(
sale
.
pn
,
sale
.
cn
),(
sale
.
vn
,
sale
.
dt
),(
sale
.
vn
,
sale
.
pn
)),(
sale
.
qty
),(
sale
.
prc
),(
sale
.
dt
);
-- ###### Queries involving STDDEV() function ###### --
SELECT
DISTINCT
sale
.
vn
,
TO_CHAR
(
COALESCE
(
STDDEV
(
DISTINCT
floor
(
sale
.
prc
+
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
cn
*
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_SAMP
(
floor
(
sale
.
qty
+
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
COUNT
(
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MIN
(
floor
(
sale
.
cn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
product
,
vendor
,
customer
WHERE
sale
.
pn
=
product
.
pn
AND
sale
.
vn
=
vendor
.
vn
AND
sale
.
cn
=
customer
.
cn
GROUP
BY
GROUPING
SETS
(
CUBE
((
sale
.
pn
,
sale
.
vn
,
sale
.
pn
),(
sale
.
cn
,
sale
.
pn
,
sale
.
vn
)))
HAVING
COALESCE
(
AVG
(
sale
.
vn
),
0
)
<=
50
.
5023418504766
AND
NOT
COALESCE
(
COUNT
(
sale
.
vn
),
0
)
<
36
.
1996525709475
;
-- ###### Queries involving STDDEV_POP() function ###### --
SELECT
DISTINCT
sale
.
vn
,
sale
.
vn
,
GROUPING
(
sale
.
vn
),
GROUP_ID
(),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
cn
+
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
pn
-
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
DISTINCT
floor
(
sale
.
vn
+
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
qty
+
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
cn
-
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
pn
/
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MAX
(
DISTINCT
floor
(
sale
.
prc
*
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MIN
(
DISTINCT
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
vendor
WHERE
sale
.
vn
=
vendor
.
vn
GROUP
BY
CUBE
((
sale
.
cn
,
sale
.
prc
),(
sale
.
vn
),(
sale
.
prc
),(
sale
.
cn
)),
CUBE
((
sale
.
cn
,
sale
.
cn
,
sale
.
qty
),(
sale
.
pn
),(
sale
.
pn
,
sale
.
dt
,
sale
.
cn
)),
ROLLUP
((
sale
.
pn
),(
sale
.
qty
,
sale
.
pn
));
-- ###### Queries involving STDDEV_SAMP() function ###### --
SELECT
DISTINCT
sale
.
vn
,
sale
.
dt
,
sale
.
prc
,
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
pn
+
sale
.
vn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
vendor
WHERE
sale
.
vn
=
vendor
.
vn
GROUP
BY
GROUPING
SETS
(
CUBE
((
sale
.
pn
),(
sale
.
dt
,
sale
.
qty
),(
sale
.
vn
,
sale
.
vn
,
sale
.
cn
),(
sale
.
cn
),(
sale
.
pn
,
sale
.
vn
))),
ROLLUP
((
sale
.
cn
,
sale
.
dt
,
sale
.
prc
),(
sale
.
pn
,
sale
.
pn
,
sale
.
cn
),(
sale
.
dt
,
sale
.
vn
,
sale
.
pn
),(
sale
.
dt
,
sale
.
cn
),(
sale
.
dt
,
sale
.
prc
,
sale
.
pn
),(
sale
.
vn
,
sale
.
qty
)),
CUBE
((
sale
.
vn
,
sale
.
cn
),(
sale
.
qty
,
sale
.
prc
),(
sale
.
qty
),(
sale
.
cn
,
sale
.
vn
),(
sale
.
vn
,
sale
.
cn
),(
sale
.
qty
,
sale
.
cn
));
-- ###### Queries involving SUM() function ###### --
SELECT
DISTINCT
sale
.
vn
,
sale
.
dt
,
sale
.
pn
,
sale
.
vn
,
sale
.
pn
,
GROUPING
(
sale
.
dt
),
GROUP_ID
(),
TO_CHAR
(
COALESCE
(
SUM
(
floor
(
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_SAMP
(
floor
(
sale
.
cn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
product
,
vendor
WHERE
sale
.
pn
=
product
.
pn
AND
sale
.
vn
=
vendor
.
vn
GROUP
BY
CUBE
((
sale
.
qty
),(
sale
.
qty
,
sale
.
qty
),(
sale
.
vn
),(
sale
.
vn
),(
sale
.
cn
),(
sale
.
dt
)),(
sale
.
qty
,
sale
.
dt
,
sale
.
vn
),(
sale
.
pn
),(
sale
.
vn
),()
HAVING
GROUP_ID
()
=
8
;
-- ###### Queries involving VAR_POP() function ###### --
SELECT
DISTINCT
sale
.
dt
,
sale
.
pn
,
sale
.
vn
,
sale
.
cn
,
sale
.
pn
,
GROUPING
(
sale
.
pn
,
sale
.
pn
,
sale
.
vn
,
sale
.
cn
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
cn
+
sale
.
cn
)),
0
),
'99999999.9999999'
)
FROM
sale
GROUP
BY
GROUPING
SETS
((
sale
.
vn
)),
sale
.
dt
,
sale
.
pn
,
sale
.
cn
;
-- ###### Queries involving VAR_SAMP() function ###### --
SELECT
DISTINCT
sale
.
pn
,
sale
.
vn
,
sale
.
cn
,
sale
.
cn
,
GROUPING
(
sale
.
vn
,
sale
.
vn
,
sale
.
cn
,
sale
.
cn
),
TO_CHAR
(
COALESCE
(
VAR_SAMP
(
floor
(
sale
.
pn
+
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
SUM
(
floor
(
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
SUM
(
DISTINCT
floor
(
sale
.
pn
+
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
SUM
(
DISTINCT
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
qty
-
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MAX
(
DISTINCT
floor
(
sale
.
vn
/
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV
(
floor
(
sale
.
qty
-
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
SUM
(
DISTINCT
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_SAMP
(
floor
(
sale
.
qty
+
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
COUNT
(
DISTINCT
floor
(
sale
.
vn
*
sale
.
qty
)),
0
),
'99999999.9999999'
)
FROM
sale
,
product
,
vendor
,
customer
WHERE
sale
.
pn
=
product
.
pn
AND
sale
.
vn
=
vendor
.
vn
AND
sale
.
cn
=
customer
.
cn
GROUP
BY
CUBE
((
sale
.
prc
,
sale
.
cn
,
sale
.
dt
),(
sale
.
pn
,
sale
.
vn
),(
sale
.
cn
),(
sale
.
qty
,
sale
.
qty
),(
sale
.
vn
,
sale
.
pn
));
-- ###### Queries involving VARIANCE() function ###### --
SELECT
DISTINCT
sale
.
cn
,
sale
.
qty
,
sale
.
vn
,
sale
.
qty
,
GROUPING
(
sale
.
cn
,
sale
.
qty
),
GROUP_ID
(),
TO_CHAR
(
COALESCE
(
VARIANCE
(
floor
(
sale
.
cn
+
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MAX
(
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
customer
,
product
WHERE
sale
.
cn
=
customer
.
cn
AND
sale
.
pn
=
product
.
pn
GROUP
BY
ROLLUP
((
sale
.
cn
,
sale
.
pn
,
sale
.
cn
),(
sale
.
cn
,
sale
.
qty
),(
sale
.
pn
),(
sale
.
prc
,
sale
.
qty
),(
sale
.
dt
,
sale
.
cn
),(
sale
.
pn
)),
CUBE
((
sale
.
vn
),(
sale
.
cn
,
sale
.
dt
,
sale
.
pn
),(
sale
.
pn
),(
sale
.
qty
,
sale
.
prc
)),(
sale
.
qty
),(
sale
.
qty
),(
sale
.
cn
,
sale
.
pn
);
-- ###### Queries involving CORR() function ###### --
SELECT
DISTINCT
sale
.
pn
,
sale
.
cn
,
GROUPING
(
sale
.
cn
),
GROUP_ID
(),
TO_CHAR
(
COALESCE
(
CORR
(
floor
(
sale
.
pn
-
sale
.
cn
),
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MIN
(
DISTINCT
floor
(
sale
.
cn
+
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MAX
(
DISTINCT
floor
(
sale
.
qty
+
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MAX
(
DISTINCT
floor
(
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
prc
)),
0
),
'99999999.9999999'
)
FROM
sale
,
product
WHERE
sale
.
pn
=
product
.
pn
GROUP
BY
ROLLUP
((
sale
.
vn
),(
sale
.
vn
),(
sale
.
qty
)),
sale
.
pn
,
sale
.
cn
;
-- ###### Queries involving COVAR_POP() function ###### --
SELECT
DISTINCT
sale
.
qty
,
sale
.
pn
,
GROUPING
(
sale
.
pn
,
sale
.
pn
),
TO_CHAR
(
COALESCE
(
COVAR_POP
(
floor
(
sale
.
prc
-
sale
.
prc
),
floor
(
sale
.
vn
-
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
qty
+
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
DISTINCT
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
product
WHERE
sale
.
pn
=
product
.
pn
GROUP
BY
(),
sale
.
qty
,
sale
.
pn
;
-- ###### Queries involving COVAR_SAMP() function ###### --
SELECT
DISTINCT
sale
.
qty
,
sale
.
qty
,
sale
.
cn
,
sale
.
cn
,
GROUP_ID
(),
TO_CHAR
(
COALESCE
(
COVAR_SAMP
(
floor
(
sale
.
pn
),
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
pn
*
sale
.
qty
)),
0
),
'99999999.9999999'
)
FROM
sale
,
product
,
vendor
,
customer
WHERE
sale
.
pn
=
product
.
pn
AND
sale
.
vn
=
vendor
.
vn
AND
sale
.
cn
=
customer
.
cn
GROUP
BY
ROLLUP
((
sale
.
vn
),(
sale
.
vn
,
sale
.
cn
)),
sale
.
qty
;
-- ###### Queries involving REGR_AVGX() function ###### --
SELECT
DISTINCT
sale
.
pn
,
sale
.
qty
,
GROUPING
(
sale
.
qty
,
sale
.
qty
),
TO_CHAR
(
COALESCE
(
REGR_AVGX
(
floor
(
sale
.
cn
*
sale
.
vn
),
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
qty
-
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
prc
/
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
DISTINCT
floor
(
sale
.
pn
+
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
DISTINCT
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
customer
WHERE
sale
.
cn
=
customer
.
cn
GROUP
BY
GROUPING
SETS
((),
CUBE
((
sale
.
cn
,
sale
.
cn
),(
sale
.
pn
),(
sale
.
cn
,
sale
.
cn
))),
sale
.
qty
;
-- ###### Queries involving REGR_AVGY() function ###### --
SELECT
DISTINCT
sale
.
qty
,
sale
.
vn
,
sale
.
cn
,
GROUPING
(
sale
.
cn
,
sale
.
vn
,
sale
.
vn
),
TO_CHAR
(
COALESCE
(
REGR_AVGY
(
floor
(
sale
.
pn
*
sale
.
cn
),
floor
(
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
floor
(
sale
.
cn
+
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
qty
+
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
COUNT
(
DISTINCT
floor
(
sale
.
qty
-
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV
(
DISTINCT
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
customer
WHERE
sale
.
cn
=
customer
.
cn
GROUP
BY
GROUPING
SETS
(()),
sale
.
qty
,
sale
.
vn
,
sale
.
cn
;
-- ###### Queries involving REGR_COUNT() function ###### --
SELECT
DISTINCT
sale
.
prc
,
sale
.
vn
,
sale
.
prc
,
GROUPING
(
sale
.
prc
),
TO_CHAR
(
COALESCE
(
REGR_COUNT
(
floor
(
sale
.
qty
),
floor
(
sale
.
prc
+
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
vn
/
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
cn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
customer
,
product
WHERE
sale
.
cn
=
customer
.
cn
AND
sale
.
pn
=
product
.
pn
GROUP
BY
ROLLUP
((
sale
.
qty
,
sale
.
dt
,
sale
.
qty
)),
sale
.
prc
,
sale
.
vn
;
-- ###### Queries involving REGR_INTERCEPT() function ###### --
SELECT
DISTINCT
sale
.
pn
,
TO_CHAR
(
COALESCE
(
REGR_INTERCEPT
(
floor
(
sale
.
pn
),
floor
(
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
SUM
(
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
DISTINCT
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_SAMP
(
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MIN
(
floor
(
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
SUM
(
DISTINCT
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MAX
(
floor
(
sale
.
cn
/
sale
.
cn
)),
0
),
'99999999.9999999'
)
FROM
sale
GROUP
BY
(),(
sale
.
qty
,
sale
.
dt
,
sale
.
cn
),(
sale
.
pn
,
sale
.
cn
,
sale
.
pn
),(
sale
.
vn
),(
sale
.
qty
);
-- ###### Queries involving REGR_R2() function ###### --
SELECT
DISTINCT
sale
.
pn
,
sale
.
qty
,
GROUP_ID
(),
TO_CHAR
(
COALESCE
(
REGR_R2
(
floor
(
sale
.
pn
),
floor
(
sale
.
prc
+
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
SUM
(
floor
(
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
COUNT
(
DISTINCT
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MAX
(
floor
(
sale
.
vn
+
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
floor
(
sale
.
vn
-
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
prc
-
sale
.
cn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
customer
,
vendor
WHERE
sale
.
cn
=
customer
.
cn
AND
sale
.
vn
=
vendor
.
vn
GROUP
BY
ROLLUP
((
sale
.
qty
),(
sale
.
pn
,
sale
.
vn
,
sale
.
vn
),(
sale
.
pn
,
sale
.
cn
,
sale
.
dt
),(
sale
.
pn
,
sale
.
vn
,
sale
.
qty
));
-- ###### Queries involving REGR_SLOPE() function ###### --
SELECT
DISTINCT
sale
.
cn
,
sale
.
dt
,
GROUP_ID
(),
TO_CHAR
(
COALESCE
(
REGR_SLOPE
(
floor
(
sale
.
qty
/
sale
.
pn
),
floor
(
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_SAMP
(
floor
(
sale
.
qty
+
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MAX
(
DISTINCT
floor
(
sale
.
pn
-
sale
.
prc
)),
0
),
'99999999.9999999'
)
FROM
sale
,
product
,
vendor
,
customer
WHERE
sale
.
pn
=
product
.
pn
AND
sale
.
vn
=
vendor
.
vn
AND
sale
.
cn
=
customer
.
cn
GROUP
BY
GROUPING
SETS
((
sale
.
pn
,
sale
.
qty
),(
sale
.
cn
)),
ROLLUP
((
sale
.
prc
,
sale
.
prc
)),
ROLLUP
((
sale
.
pn
,
sale
.
pn
),(
sale
.
qty
,
sale
.
vn
),(
sale
.
cn
,
sale
.
pn
,
sale
.
qty
),(
sale
.
pn
),(
sale
.
cn
,
sale
.
prc
),(
sale
.
cn
)),
sale
.
dt
HAVING
GROUP_ID
()
>=
0
;
-- ###### Queries involving REGR_SXX() function ###### --
SELECT
DISTINCT
sale
.
cn
,
sale
.
qty
,
sale
.
cn
,
sale
.
qty
,
GROUPING
(
sale
.
qty
,
sale
.
cn
,
sale
.
qty
),
GROUP_ID
(),
TO_CHAR
(
COALESCE
(
REGR_SXX
(
floor
(
sale
.
qty
*
sale
.
pn
),
floor
(
sale
.
vn
/
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
SUM
(
DISTINCT
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_SAMP
(
floor
(
sale
.
pn
-
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
qty
-
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MIN
(
floor
(
sale
.
vn
*
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
floor
(
sale
.
vn
/
sale
.
pn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
product
WHERE
sale
.
pn
=
product
.
pn
GROUP
BY
GROUPING
SETS
(
CUBE
((
sale
.
pn
),(
sale
.
qty
,
sale
.
qty
)),(),
CUBE
((
sale
.
pn
),(
sale
.
vn
,
sale
.
vn
),(
sale
.
vn
,
sale
.
prc
),(
sale
.
prc
),(
sale
.
pn
,
sale
.
qty
),(
sale
.
pn
,
sale
.
qty
))),
ROLLUP
((
sale
.
dt
),(
sale
.
vn
,
sale
.
vn
),(
sale
.
prc
,
sale
.
cn
),(
sale
.
dt
,
sale
.
vn
),(
sale
.
dt
,
sale
.
vn
),(
sale
.
vn
,
sale
.
vn
));
-- ###### Queries involving REGR_SXY() function ###### --
SELECT
DISTINCT
sale
.
cn
,
sale
.
vn
,
TO_CHAR
(
COALESCE
(
REGR_SXY
(
floor
(
sale
.
cn
),
floor
(
sale
.
qty
/
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
floor
(
sale
.
cn
*
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
COUNT
(
floor
(
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
COUNT
(
floor
(
sale
.
qty
-
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
vendor
WHERE
sale
.
vn
=
vendor
.
vn
GROUP
BY
ROLLUP
((
sale
.
pn
),(
sale
.
pn
,
sale
.
cn
),(
sale
.
vn
),(
sale
.
pn
)),
GROUPING
SETS
((),
ROLLUP
((
sale
.
prc
,
sale
.
pn
),(
sale
.
cn
,
sale
.
cn
,
sale
.
pn
),(
sale
.
vn
,
sale
.
pn
)),
ROLLUP
((
sale
.
pn
)));
-- ###### Queries involving REGR_SYY() function ###### --
SELECT
DISTINCT
sale
.
cn
,
sale
.
cn
,
sale
.
qty
,
sale
.
dt
,
sale
.
qty
,
sale
.
cn
,
GROUPING
(
sale
.
cn
,
sale
.
qty
,
sale
.
qty
,
sale
.
cn
,
sale
.
dt
,
sale
.
cn
),
GROUP_ID
(),
TO_CHAR
(
COALESCE
(
REGR_SYY
(
floor
(
sale
.
prc
),
floor
(
sale
.
pn
*
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
COUNT
(
DISTINCT
floor
(
sale
.
pn
+
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV
(
DISTINCT
floor
(
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV
(
floor
(
sale
.
prc
/
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
AVG
(
floor
(
sale
.
qty
+
sale
.
pn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
customer
,
vendor
WHERE
sale
.
cn
=
customer
.
cn
AND
sale
.
vn
=
vendor
.
vn
GROUP
BY
ROLLUP
((
sale
.
qty
,
sale
.
dt
)),
ROLLUP
((
sale
.
pn
,
sale
.
vn
),(
sale
.
qty
,
sale
.
cn
),(
sale
.
cn
),(
sale
.
cn
,
sale
.
qty
)),(
sale
.
vn
,
sale
.
qty
);
-- ###### Queries involving AVG() function ###### --
SELECT
DISTINCT
sale
.
vn
,
sale
.
pn
,
sale
.
cn
,
GROUPING
(
sale
.
pn
,
sale
.
pn
),
TO_CHAR
(
COALESCE
(
AVG
(
DISTINCT
floor
(
sale
.
prc
*
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
COUNT
(
floor
(
sale
.
qty
+
sale
.
qty
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MIN
(
floor
(
sale
.
cn
*
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
COUNT
(
DISTINCT
floor
(
sale
.
pn
*
sale
.
prc
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV
(
DISTINCT
floor
(
sale
.
pn
*
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MAX
(
DISTINCT
floor
(
sale
.
vn
/
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
VAR_POP
(
floor
(
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
MIN
(
floor
(
sale
.
qty
-
sale
.
cn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
STDDEV_POP
(
floor
(
sale
.
prc
-
sale
.
pn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
SUM
(
DISTINCT
floor
(
sale
.
vn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
vendor
WHERE
sale
.
vn
=
vendor
.
vn
GROUP
BY
CUBE
((
sale
.
cn
,
sale
.
vn
)),(
sale
.
qty
),(
sale
.
cn
),(
sale
.
vn
,
sale
.
prc
),(
sale
.
qty
),(
sale
.
pn
,
sale
.
pn
,
sale
.
qty
),(
sale
.
pn
),(
sale
.
cn
,
sale
.
prc
),(
sale
.
qty
);
-- ###### Queries involving COUNT() function ###### --
SELECT
DISTINCT
sale
.
cn
,
sale
.
vn
,
sale
.
qty
,
sale
.
pn
,
TO_CHAR
(
COALESCE
(
COUNT
(
floor
(
sale
.
prc
-
sale
.
vn
)),
0
),
'99999999.9999999'
),
TO_CHAR
(
COALESCE
(
SUM
(
floor
(
sale
.
cn
-
sale
.
vn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
product
,
vendor
,
customer
WHERE
sale
.
pn
=
product
.
pn
AND
sale
.
vn
=
vendor
.
vn
AND
sale
.
cn
=
customer
.
cn
GROUP
BY
CUBE
((
sale
.
qty
,
sale
.
dt
),(
sale
.
dt
),(
sale
.
vn
),(
sale
.
pn
,
sale
.
qty
,
sale
.
vn
)),
GROUPING
SETS
(
CUBE
((
sale
.
cn
,
sale
.
qty
),(
sale
.
vn
,
sale
.
prc
))),
GROUPING
SETS
((),
CUBE
((
sale
.
cn
,
sale
.
pn
),(
sale
.
dt
,
sale
.
dt
),(
sale
.
vn
),(
sale
.
cn
,
sale
.
prc
,
sale
.
pn
)),
ROLLUP
((
sale
.
cn
),(
sale
.
vn
),(
sale
.
qty
),(
sale
.
vn
,
sale
.
dt
)));
-- ###### Queries involving MAX() function ###### --
SELECT
DISTINCT
sale
.
vn
,
TO_CHAR
(
COALESCE
(
MAX
(
DISTINCT
floor
(
sale
.
prc
/
sale
.
vn
)),
0
),
'99999999.9999999'
)
FROM
sale
,
product
WHERE
sale
.
pn
=
product
.
pn
GROUP
BY
ROLLUP
((
sale
.
prc
),(
sale
.
prc
,
sale
.
vn
),(
sale
.
qty
,
sale
.
qty
),(
sale
.
vn
)),
GROUPING
SETS
((),
ROLLUP
((
sale
.
prc
,
sale
.
cn
,
sale
.
prc
),(
sale
.
cn
,
sale
.
cn
),(
sale
.
vn
),(
sale
.
vn
,
sale
.
cn
))),
GROUPING
SETS
(
CUBE
((
sale
.
cn
),(
sale
.
pn
,
sale
.
qty
,
sale
.
qty
)),
ROLLUP
((
sale
.
prc
,
sale
.
cn
,
sale
.
prc
),(
sale
.
qty
)));
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录