Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
1d794dfc
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,发现更多精彩内容 >>
提交
1d794dfc
编写于
3月 22, 2016
作者:
N
Nikos Armenatzoglou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Porting resource_queue tests from cdbfast to ICG
上级
688e9427
变更
3
展开全部
显示空白变更内容
内联
并排
Showing
3 changed file
with
925 addition
and
1 deletion
+925
-1
src/test/regress/expected/qp_resource_queue.out
src/test/regress/expected/qp_resource_queue.out
+598
-0
src/test/regress/greenplum_schedule
src/test/regress/greenplum_schedule
+1
-1
src/test/regress/sql/qp_resource_queue.sql
src/test/regress/sql/qp_resource_queue.sql
+326
-0
未找到文件。
src/test/regress/expected/qp_resource_queue.out
0 → 100644
浏览文件 @
1d794dfc
此差异已折叠。
点击以展开。
src/test/regress/greenplum_schedule
浏览文件 @
1d794dfc
...
...
@@ -89,7 +89,7 @@ test: qp_executor qp_olap_windowerr qp_olap_window qp_derived_table qp_bitmapsca
test: qp_correlated_query
test: qp_dpe qp_subquery qp_function qp_regexp
test: qp_dpe qp_subquery qp_function qp_regexp
qp_resource_queue
ignore: tpch500GB_orca
...
...
src/test/regress/sql/qp_resource_queue.sql
0 → 100644
浏览文件 @
1d794dfc
-- ----------------------------------------------------------------------
-- Test: setup_schema.sql
-- ----------------------------------------------------------------------
-- start_ignore
create
schema
qp_resource_queue
;
set
search_path
to
qp_resource_queue
;
-- end_ignore
-- ----------------------------------------------------------------------
-- Test: setup.sql
-- ----------------------------------------------------------------------
-- start_ignore
drop
role
if
exists
tbl16369_user1
;
drop
role
if
exists
tbl16369_user3
;
drop
resource
queue
tbl16369_resq1
;
drop
resource
queue
tbl16369_resq3
;
drop
function
if
exists
tbl16369_func1
();
drop
function
if
exists
tbl16369_func2
();
drop
function
if
exists
tbl16369_func3
(
refcursor
,
refcursor
);
drop
function
if
exists
tbl16369_func4
();
drop
function
if
exists
tbl16369_func5
();
drop
function
if
exists
tbl16369_func6
();
drop
function
if
exists
tbl16369_func7
();
drop
function
if
exists
tbl16369_func8
();
drop
function
if
exists
tbl16369_func9
();
drop
function
if
exists
tbl16369_func10
(
param_numcount
integer
);
drop
function
if
exists
tbl16369_func11
(
param_numcount
integer
);
drop
function
if
exists
tbl16369_func12
();
drop
table
if
exists
tbl16369_test
;
drop
table
if
exists
tbl16369_zipcode_gis
;
drop
table
if
exists
tbl16369_test1
;
drop
table
if
exists
tbl16369_x
;
-- end_ignore
create
resource
queue
tbl16369_resq1
WITH
(
ACTIVE_STATEMENTS
=
1
);
CREATE
ROLE
tbl16369_user1
LOGIN
PASSWORD
'tbl16369pwd'
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREATEROLE
RESOURCE
QUEUE
tbl16369_resq1
;
create
resource
queue
tbl16369_resq3
WITH
(
ACTIVE_STATEMENTS
=
1
,
MEMORY_LIMIT
=
'200MB'
);
CREATE
ROLE
tbl16369_user3
LOGIN
PASSWORD
'tbl16369pwd'
NOSUPERUSER
INHERIT
NOCREATEDB
NOCREATEROLE
RESOURCE
QUEUE
tbl16369_resq3
;
-- start_ignore
drop
role
if
exists
gpadmin
;
create
role
gpadmin
login
superuser
;
-- end_ignore
grant
gpadmin
to
tbl16369_user1
;
grant
gpadmin
to
tbl16369_user3
;
Drop
table
if
exists
tbl16369_test
;
create
table
tbl16369_test
(
col
text
);
CREATE
TABLE
tbl16369_zipcode_gis
(
zipcode
INTEGER
,
zip_col1
INTEGER
,
zip_col2
INTEGER
)
DISTRIBUTED
BY
(
zipcode
);
insert
into
tbl16369_test
values
(
'789'
),(
'789'
),(
'789'
),(
'789'
),(
'789'
),(
'789'
);
create
table
tbl16369_test1
(
a
text
,
b
int
);
insert
into
tbl16369_test1
values
(
'456'
,
456
),(
'012'
,
12
),(
'901'
,
901
),(
'678'
,
678
),(
'789'
,
789
),(
'345'
,
345
);
insert
into
tbl16369_test1
values
(
'456'
,
456
),(
'012'
,
12
),(
'901'
,
901
),(
'678'
,
678
),(
'789'
,
789
),(
'345'
,
345
);
create
table
tbl16369_x
(
x
int
);
insert
into
tbl16369_x
values
(
456
),(
12
),(
901
),(
678
),(
789
),(
345
);
insert
into
tbl16369_x
values
(
456
),(
12
),(
901
),(
678
),(
789
),(
345
);
INSERT
INTO
tbl16369_zipcode_gis
VALUES
(
94403
,
123
,
123
);
INSERT
INTO
tbl16369_zipcode_gis
VALUES
(
94404
,
321
,
321
);
INSERT
INTO
tbl16369_zipcode_gis
VALUES
(
90405
,
234
,
234
);
CREATE
FUNCTION
tbl16369_func1
()
RETURNS
tbl16369_test
AS
$$
DECLARE
res
tbl16369_test
;
BEGIN
select
*
into
res
from
tbl16369_test
;
return
res
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
FUNCTION
tbl16369_func2
()
RETURNS
tbl16369_test
AS
$$
DECLARE
rec
tbl16369_test
;
ref
refcursor
;
BEGIN
OPEN
ref
FOR
SELECT
*
FROM
tbl16369_test
;
FETCH
ref
into
rec
;
CLOSE
ref
;
RETURN
rec
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
FUNCTION
tbl16369_func3
(
refcursor
,
refcursor
)
RETURNS
SETOF
refcursor
AS
$$
BEGIN
OPEN
$
1
FOR
SELECT
*
FROM
tbl16369_zipcode_gis
;
RETURN
NEXT
$
1
;
OPEN
$
2
FOR
SELECT
*
FROM
tbl16369_test
;
RETURN
NEXT
$
2
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
FUNCTION
tbl16369_func4
()
RETURNS
tbl16369_test
AS
$$
DECLARE
res
tbl16369_test
;
BEGIN
select
tbl16369_func1
()
into
res
;
return
res
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
FUNCTION
tbl16369_func5
()
RETURNS
tbl16369_test
AS
$$
DECLARE
res
tbl16369_test
;
BEGIN
select
tbl16369_func2
()
into
res
;
return
res
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
FUNCTION
tbl16369_func6
()
RETURNS
setof
refcursor
AS
$$
DECLARE
ref1
refcursor
;
BEGIN
select
tbl16369_func3
(
'a'
,
'b'
)
into
ref1
;
return
next
ref1
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
FUNCTION
tbl16369_func7
()
RETURNS
tbl16369_test
AS
$$
DECLARE
ref
refcursor
;
rec
tbl16369_test
;
BEGIN
OPEN
ref
FOR
SELECT
tbl16369_func1
();
FETCH
ref
into
rec
;
CLOSE
ref
;
RETURN
rec
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
FUNCTION
tbl16369_func8
()
RETURNS
tbl16369_test
AS
$$
DECLARE
ref
refcursor
;
rec
tbl16369_test
;
BEGIN
OPEN
ref
FOR
SELECT
tbl16369_func2
();
FETCH
ref
into
rec
;
CLOSE
ref
;
RETURN
rec
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
FUNCTION
tbl16369_func9
()
RETURNS
setof
refcursor
AS
$$
DECLARE
ref
refcursor
;
ref1
refcursor
;
BEGIN
OPEN
ref
FOR
SELECT
tbl16369_func3
(
'a'
,
'b'
);
FETCH
ref
into
ref1
;
CLOSE
ref
;
RETURN
next
ref1
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
OR
REPLACE
FUNCTION
tbl16369_func10
(
param_numcount
integer
)
RETURNS
tbl16369_test
AS
$$
DECLARE
res
tbl16369_test
;
BEGIN
IF
param_numcount
<
0
THEN
RAISE
EXCEPTION
'Negative numbers are not allowed'
;
ELSIF
param_numcount
>
0
THEN
RAISE
NOTICE
'Yo there I
''
m number %, next: %'
,
param_numcount
,
param_numcount
-
1
;
res
:
=
tbl16369_func10
(
param_numcount
-
1
);
ELSE
RAISE
INFO
'Alas we are at the end of our journey'
;
select
*
into
res
from
tbl16369_test
;
END
IF
;
RETURN
res
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
OR
REPLACE
FUNCTION
tbl16369_func11
(
param_numcount
integer
)
RETURNS
tbl16369_test
AS
$$
DECLARE
res
tbl16369_test
;
ref
refcursor
;
BEGIN
IF
param_numcount
<
0
THEN
RAISE
EXCEPTION
'Negative numbers are not allowed'
;
ELSIF
param_numcount
>
0
THEN
RAISE
NOTICE
'Yo there I
''
m number %, next: %'
,
param_numcount
,
param_numcount
-
1
;
res
:
=
tbl16369_func11
(
param_numcount
-
1
);
ELSE
RAISE
INFO
'Alas we are at the end of our journey'
;
open
ref
for
select
*
from
tbl16369_test
;
FETCH
ref
into
res
;
CLOSE
ref
;
END
IF
;
RETURN
res
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
CREATE
FUNCTION
tbl16369_func12
()
RETURNS
float
AS
$$
DECLARE
ref
refcursor
;
res
float
;
BEGIN
OPEN
ref
FOR
select
avg
(
foo
.
b
)
from
(
select
tbl16369_test1
.
b
from
tbl16369_test
,
tbl16369_test1
where
tbl16369_test
.
col
=
tbl16369_test1
.
a
and
tbl16369_test1
.
b
in
(
select
x
from
tbl16369_x
))
as
foo
;
FETCH
ref
into
res
;
CLOSE
ref
;
RETURN
res
;
END
;
$$
LANGUAGE
plpgsql
READS
SQL
DATA
;
Drop
table
if
exists
zipcode_gis
;
Drop
table
if
exists
x
;
Drop
table
if
exists
test1
;
Drop
function
complexquery
();
Drop
table
if
exists
test
;
create
table
test
(
col
text
);
CREATE
TABLE
zipcode_gis
(
zipcode
INTEGER
,
zip_col1
INTEGER
,
zip_col2
INTEGER
)
DISTRIBUTED
BY
(
zipcode
);
insert
into
test
values
(
'456'
),(
'789'
),(
'012'
),(
'345'
),(
'678'
),(
'901'
);
create
table
test1
(
a
text
,
b
int
);
insert
into
test1
values
(
'456'
,
456
),(
'012'
,
12
),(
'901'
,
901
),(
'678'
,
678
),(
'789'
,
789
),(
'345'
,
345
);
insert
into
test1
values
(
'654'
,
456
),(
'210'
,
12
),(
'109'
,
901
),(
'876'
,
678
),(
'987'
,
789
),(
'543'
,
345
);
create
table
x
(
x
int
);
insert
into
x
values
(
456
),(
12
),(
901
),(
678
),(
789
),(
345
);
insert
into
x
values
(
456
),(
12
),(
901
),(
678
),(
789
),(
345
);
select
avg
(
foo
.
b
)
from
(
select
test1
.
b
from
test
,
test1
where
test
.
col
=
test1
.
a
and
test1
.
b
in
(
select
x
from
x
))
as
foo
;
CREATE
FUNCTION
complexquery
()
RETURNS
float
AS
$$
DECLARE
ref
refcursor
;
res
float
;
BEGIN
OPEN
ref
FOR
select
avg
(
foo
.
b
)
from
(
select
test1
.
b
from
test
,
test1
where
test
.
col
=
test1
.
a
and
test1
.
b
in
(
select
x
from
x
))
as
foo
;
FETCH
ref
into
res
;
CLOSE
ref
;
RETURN
res
;
END
;
$$
LANGUAGE
plpgsql
;
-- ----------------------------------------------------------------------
-- Test: test01_simple_function.sql
-- ----------------------------------------------------------------------
select
tbl16369_func1
();
-- ----------------------------------------------------------------------
-- Test: test02_fn_with_simple_cursor.sql
-- ----------------------------------------------------------------------
select
tbl16369_func2
();
-- ----------------------------------------------------------------------
-- Test: test03_fn_with_cursor_as_arg_rtntype.sql
-- ----------------------------------------------------------------------
select
tbl16369_func3
(
'a'
,
'b'
);
-- ----------------------------------------------------------------------
-- Test: test04_nested_simple_qry_calls_simple_qry.sql
-- ----------------------------------------------------------------------
select
tbl16369_func4
();
-- ----------------------------------------------------------------------
-- Test: test05_nested_simple_qry_calls_cursor.sql
-- ----------------------------------------------------------------------
select
tbl16369_func5
();
-- ----------------------------------------------------------------------
-- Test: test06_nested_simple_qry_calls_cursor_as_arg_rtntype.sql
-- ----------------------------------------------------------------------
select
tbl16369_func6
();
-- ----------------------------------------------------------------------
-- Test: test07_nested_cursor_calls_simple_query_tbl16369_user1.sql
-- ----------------------------------------------------------------------
select
tbl16369_func7
();
-- ----------------------------------------------------------------------
-- Test: test07_nested_cursor_calls_simple_query_tbl16369_user3.sql
-- ----------------------------------------------------------------------
select
tbl16369_func7
();
-- ----------------------------------------------------------------------
-- Test: test08_nested_cursor_calls_cursor_tbl16369_user1.sql
-- ----------------------------------------------------------------------
select
tbl16369_func8
();
-- ----------------------------------------------------------------------
-- Test: test08_nested_cursor_calls_cursor_tbl16369_user3.sql
-- ----------------------------------------------------------------------
select
tbl16369_func8
();
-- ----------------------------------------------------------------------
-- Test: test09_nested_cursor_calls_cursor_as_arg_rtntype_tbl16369_user1.sql
-- ----------------------------------------------------------------------
select
tbl16369_func9
();
-- ----------------------------------------------------------------------
-- Test: test09_nested_cursor_calls_cursor_as_arg_rtntype_tbl16369_user3.sql
-- ----------------------------------------------------------------------
select
tbl16369_func9
();
-- ----------------------------------------------------------------------
-- Test: test10_recursive_plpgsql_functions.sql
-- ----------------------------------------------------------------------
select
tbl16369_func10
(
5
);
-- ----------------------------------------------------------------------
-- Test: test11_recursive_plpgsql_functions_with_curosr.sql
-- ----------------------------------------------------------------------
select
tbl16369_func11
(
5
);
-- ----------------------------------------------------------------------
-- Test: test12_funtion_with_complex_query.sql
-- ----------------------------------------------------------------------
select
avg
(
foo
.
b
)
from
(
select
test1
.
b
from
test
,
test1
where
test
.
col
=
test1
.
a
and
test1
.
b
in
(
select
x
from
x
))
as
foo
;
select
complexquery
();
-- ----------------------------------------------------------------------
-- Test: test13_funtion_with_complex_query_in_cursor.sql
-- ----------------------------------------------------------------------
select
tbl16369_func12
();
-- ----------------------------------------------------------------------
-- Test: test14_multiple_function_calls.sql
-- ----------------------------------------------------------------------
select
tbl16369_func1
(),
tbl16369_func2
(),
tbl16369_func4
(),
tbl16369_func5
(),
tbl16369_func10
(
5
),
tbl16369_func11
(
5
),
tbl16369_func12
(),
generate_series
(
1
,
10
);
-- ----------------------------------------------------------------------
-- Test: teardown.sql
-- ----------------------------------------------------------------------
-- start_ignore
drop
schema
qp_resource_queue
cascade
;
-- end_ignore
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录