Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
5c43dbb6
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,发现更多精彩内容 >>
提交
5c43dbb6
编写于
2月 20, 2017
作者:
H
Heikki Linnakangas
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move partition_ddl1 test from TINC.
Much of it was present in partition1 test already.
上级
0e864408
变更
4
展开全部
隐藏空白更改
内联
并排
Showing
4 changed file
with
601 addition
and
2124 deletion
+601
-2124
src/test/regress/expected/partition1.out
src/test/regress/expected/partition1.out
+543
-0
src/test/regress/sql/partition1.sql
src/test/regress/sql/partition1.sql
+58
-0
src/test/tinc/tincrepo/mpp/gpdb/tests/storage/basic/partition/expected/partition_ddl1.ans
...tests/storage/basic/partition/expected/partition_ddl1.ans
+0
-1449
src/test/tinc/tincrepo/mpp/gpdb/tests/storage/basic/partition/sql/partition_ddl1.sql
...gpdb/tests/storage/basic/partition/sql/partition_ddl1.sql
+0
-675
未找到文件。
src/test/regress/expected/partition1.out
浏览文件 @
5c43dbb6
此差异已折叠。
点击以展开。
src/test/regress/sql/partition1.sql
浏览文件 @
5c43dbb6
...
...
@@ -1509,3 +1509,61 @@ drop table if exists s1;
drop
table
if
exists
s2
;
-- end_ignore
create
table
mpp_2914A
(
id
int
,
buyDate
date
,
kind
char
(
1
))
DISTRIBUTED
BY
(
id
)
partition
by
list
(
kind
)
subpartition
by
range
(
buyDate
)
subpartition
template
(
start
(
date
'2001-01-01'
),
start
(
date
'2002-01-01'
),
start
(
date
'2003-01-01'
),
start
(
date
'2004-01-01'
),
start
(
date
'2005-01-01'
)
)
(
partition
auction
values
(
'a'
,
'A'
),
partition
buyItNow
values
(
'b'
,
'B'
),
default
partition
catchall
);
select
count
(
*
)
from
mpp_2914A
;
\
d
mpp_2914a
*
create
table
mpp_2914B
(
id
int
,
buyDate
date
,
kind
char
(
1
))
DISTRIBUTED
BY
(
id
)
partition
by
list
(
kind
)
subpartition
by
range
(
buyDate
)
(
partition
auction
values
(
'a'
,
'A'
)
(
subpartition
y2001
start
(
date
'2001-01-01'
),
subpartition
y2002
start
(
date
'2002-01-01'
),
subpartition
y2003
start
(
date
'2003-01-01'
),
subpartition
y2004
start
(
date
'2004-01-01'
),
subpartition
y2005
start
(
date
'2005-01-01'
)
),
partition
buyitnow
values
(
'b'
,
'B'
)
(
subpartition
y2001
start
(
date
'2001-01-01'
),
subpartition
y2002
start
(
date
'2002-01-01'
),
subpartition
y2003
start
(
date
'2003-01-01'
),
subpartition
y2004
start
(
date
'2004-01-01'
),
subpartition
y2005
start
(
date
'2005-01-01'
)
),
default
partition
catchAll
(
subpartition
y2001
start
(
date
'2001-01-01'
),
subpartition
y2002
start
(
date
'2002-01-01'
),
subpartition
y2003
start
(
date
'2003-01-01'
),
subpartition
y2004
start
(
date
'2004-01-01'
),
subpartition
y2005
start
(
date
'2005-01-01'
)
)
);
select
count
(
*
)
from
mpp_2914B
;
\
d
mpp_2914b
*
drop
table
mpp_2914a
cascade
;
drop
table
mpp_2914b
cascade
;
src/test/tinc/tincrepo/mpp/gpdb/tests/storage/basic/partition/expected/partition_ddl1.ans
已删除
100644 → 0
浏览文件 @
0e864408
此差异已折叠。
点击以展开。
src/test/tinc/tincrepo/mpp/gpdb/tests/storage/basic/partition/sql/partition_ddl1.sql
已删除
100644 → 0
浏览文件 @
0e864408
set
client_min_messages
=
WARNING
;
set
gp_enable_hash_partitioned_tables
=
true
;
DROP
SCHEMA
IF
EXISTS
partition_ddl1
CASCADE
;
CREATE
SCHEMA
partition_ddl1
;
SET
search_path
TO
partition_ddl1
;
-- disabled by default
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partItion
by
hash
(
b
)
partitions
3
;
-- missing subpartition by
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
(
partition
aa
(
subpartition
cc
,
subpartition
dd
),
partition
bb
(
subpartition
cc
,
subpartition
dd
)
);
-- missing subpartition spec
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
(
partition
aa
,
partition
bb
);
-- subpart spec conflict
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
subpartition
template
(
subpartition
jjj
)
(
partition
aa
(
subpartition
cc
,
subpartition
dd
),
partition
bb
(
subpartition
cc
,
subpartition
dd
)
);
-- missing subpartition by
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
(
partition
aa
(
subpartition
cc
,
subpartition
dd
(
subpartition
iii
)),
partition
bb
(
subpartition
cc
,
subpartition
dd
)
);
-- missing subpartition spec
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
,
subpartition
by
hash
(
d
)
(
partition
aa
(
subpartition
cc
,
subpartition
dd
),
partition
bb
(
subpartition
cc
,
subpartition
dd
)
);
drop
table
if
exists
ggg
cascade
;
-- should work
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
(
partition
aa
(
subpartition
cc
,
subpartition
dd
),
partition
bb
(
subpartition
cc
,
subpartition
dd
)
);
drop
table
ggg
cascade
;
-- should work
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
subpartition
template
(
subpartition
cc
,
subpartition
dd
),
subpartition
by
hash
(
d
)
subpartition
template
(
subpartition
ee
,
subpartition
ff
)
(
partition
aa
,
partition
bb
);
drop
table
ggg
cascade
;
-- should work
drop
table
if
exists
ggg
cascade
;
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
,
subpartition
by
hash
(
d
)
subpartition
template
(
subpartition
ee
,
subpartition
ff
)
(
partition
aa
(
subpartition
cc
,
subpartition
dd
),
partition
bb
(
subpartition
cc
,
subpartition
dd
)
);
drop
table
ggg
cascade
;
-- doesn't work because cannot have nested declaration in template
drop
table
if
exists
ggg
;
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
subpartition
template
(
subpartition
cc
(
subpartition
ee
,
subpartition
ff
),
subpartition
dd
(
subpartition
ee
,
subpartition
ff
)
),
subpartition
by
hash
(
d
)
(
partition
aa
,
partition
bb
);
drop
table
ggg
cascade
;
--ERROR: Missing boundary specification in partition 'aa' of type LIST
create
table
fff
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
list
(
b
)
(
partition
aa
);
-- number 1 of type LIST
create
table
fff
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
list
(
b
)
(
start
with
(
'a'
)
);
-- should work
create
table
fff
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
list
(
b
)
(
partition
aa
values
(
'2'
));
drop
table
fff
cascade
;
-- type HASH (at depth 2)
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
,
subpartition
by
hash
(
d
)
subpartition
template
(
subpartition
ee
,
subpartition
ff
)
(
partition
aa
(
subpartition
cc
,
subpartition
dd
),
partition
bb
(
subpartition
cc
start
with
(
'a'
)
,
subpartition
dd
)
);
-- generate 2 anonymous partitions
drop
table
if
exists
ggg
;
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
))
distributed
by
(
a
)
partition
by
range
(
b
)
(
partition
aa
start
(
'2007'
),
end
(
'2008'
),
partition
bb
start
(
'2008'
),
end
(
'2009'
)
);
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
))
distributed
by
(
a
)
partition
by
range
(
b
)
(
partition
aa
start
(
date
'2007-01-01'
)
end
(
date
'2008-01-01'
),
partition
bb
start
(
date
'2008-01-01'
)
end
(
date
'2009-01-01'
)
);
drop
table
ggg
cascade
;
-- don't allow nonconstant expressions, even simple ones...
create
table
ggg
(
a
char
(
1
),
b
numeric
,
d
numeric
)
distributed
by
(
a
)
partition
by
range
(
b
,
d
)
(
partition
aa
start
(
2007
,
1
)
end
(
2008
,
2
+
2
),
partition
bb
start
(
2008
,
2
)
end
(
2009
,
3
)
);
-- should work
create
table
ggg
(
a
char
(
1
),
b
numeric
,
d
numeric
)
distributed
by
(
a
)
partition
by
range
(
b
,
d
)
(
partition
aa
start
(
2007
,
1
)
end
(
2008
,
2
),
partition
bb
start
(
2008
,
2
)
end
(
2009
,
3
)
);
drop
table
ggg
cascade
;
-- nested subpartitions
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
),
e
numeric
,
f
numeric
,
g
numeric
,
h
numeric
)
distributed
by
(
a
)
partition
by
hash
(
b
)
partitions
2
subpartition
by
hash
(
d
)
subpartitions
2
,
subpartition
by
hash
(
e
)
subpartitions
2
,
subpartition
by
hash
(
f
)
subpartitions
2
,
subpartition
by
hash
(
g
)
subpartitions
2
,
subpartition
by
hash
(
h
)
subpartitions
2
;
drop
table
ggg
cascade
;
-- named, inline subpartitions
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
(
partition
aa
(
subpartition
cc
,
subpartition
dd
),
partition
bb
(
subpartition
cc
,
subpartition
dd
)
);
drop
table
ggg
cascade
;
-- subpartitions with templates
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
),
e
numeric
)
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
subpartition
template
(
subpartition
cc
,
subpartition
dd
),
subpartition
by
hash
(
e
)
subpartition
template
(
subpartition
ee
,
subpartition
ff
)
(
partition
aa
,
partition
bb
);
drop
table
ggg
cascade
;
-- mixed inline subpartition declarations with templates
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
),
e
numeric
)
distributed
by
(
a
)
partition
by
hash
(
b
)
subpartition
by
hash
(
d
)
,
subpartition
by
hash
(
e
)
subpartition
template
(
subpartition
ee
,
subpartition
ff
)
(
partition
aa
(
subpartition
cc
,
subpartition
dd
),
partition
bb
(
subpartition
cc
,
subpartition
dd
)
);
drop
table
ggg
cascade
;
-- basic list partition
create
table
ggg
(
a
char
(
1
),
b
char
(
2
),
d
char
(
3
))
distributed
by
(
a
)
partition
by
LIST
(
b
)
(
partition
aa
values
(
'a'
,
'b'
,
'c'
,
'd'
),
partition
bb
values
(
'e'
,
'f'
,
'g'
)
);
insert
into
ggg
values
(
'x'
,
'a'
);
insert
into
ggg
values
(
'x'
,
'b'
);
insert
into
ggg
values
(
'x'
,
'c'
);
insert
into
ggg
values
(
'x'
,
'd'
);
insert
into
ggg
values
(
'x'
,
'e'
);
insert
into
ggg
values
(
'x'
,
'f'
);
insert
into
ggg
values
(
'x'
,
'g'
);
insert
into
ggg
values
(
'x'
,
'a'
);
insert
into
ggg
values
(
'x'
,
'b'
);
insert
into
ggg
values
(
'x'
,
'c'
);
insert
into
ggg
values
(
'x'
,
'd'
);
insert
into
ggg
values
(
'x'
,
'e'
);
insert
into
ggg
values
(
'x'
,
'f'
);
insert
into
ggg
values
(
'x'
,
'g'
);
select
*
from
ggg
;
select
*
from
ggg_1_prt_aa
;
select
*
from
ggg_1_prt_bb
;
drop
table
ggg
cascade
;
-- documentation example - partition by list and range
CREATE
TABLE
rank
(
id
int
,
rank
int
,
year
date
,
gender
char
(
1
))
DISTRIBUTED
BY
(
id
,
gender
,
year
)
partition
by
list
(
gender
)
subpartition
by
range
(
year
)
subpartition
template
(
start
(
date
'2001-01-01'
),
start
(
date
'2002-01-01'
),
start
(
date
'2003-01-01'
),
start
(
date
'2004-01-01'
),
start
(
date
'2005-01-01'
)
)
(
partition
boys
values
(
'M'
),
partition
girls
values
(
'F'
)
);
insert
into
rank
values
(
1
,
1
,
date
'2001-01-15'
,
'M'
);
insert
into
rank
values
(
2
,
1
,
date
'2002-02-15'
,
'M'
);
insert
into
rank
values
(
3
,
1
,
date
'2003-03-15'
,
'M'
);
insert
into
rank
values
(
4
,
1
,
date
'2004-04-15'
,
'M'
);
insert
into
rank
values
(
5
,
1
,
date
'2005-05-15'
,
'M'
);
insert
into
rank
values
(
6
,
1
,
date
'2001-01-15'
,
'F'
);
insert
into
rank
values
(
7
,
1
,
date
'2002-02-15'
,
'F'
);
insert
into
rank
values
(
8
,
1
,
date
'2003-03-15'
,
'F'
);
insert
into
rank
values
(
9
,
1
,
date
'2004-04-15'
,
'F'
);
insert
into
rank
values
(
10
,
1
,
date
'2005-05-15'
,
'F'
);
select
*
from
rank
;
select
*
from
rank_1_prt_boys
;
select
*
from
rank_1_prt_girls
;
select
*
from
rank_1_prt_girls_2_prt_1
;
select
*
from
rank_1_prt_girls_2_prt_2
;
drop
table
rank
cascade
;
-- range list hash combo
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
),
e
numeric
)
distributed
by
(
a
)
partition
by
range
(
b
)
subpartition
by
list
(
d
),
subpartition
by
hash
(
e
)
subpartitions
3
(
partition
aa
start
(
date
'2007-01-01'
)
end
(
date
'2008-01-01'
)
(
subpartition
dd
values
(
1
,
2
,
3
),
subpartition
ee
values
(
4
,
5
,
6
)),
partition
bb
start
(
date
'2008-01-01'
)
end
(
date
'2009-01-01'
)
(
subpartition
dd
values
(
1
,
2
,
3
),
subpartition
ee
values
(
4
,
5
,
6
))
);
drop
table
ggg
cascade
;
-- duplicate partition name
CREATE
TABLE
rank
(
id
int
,
rank
int
,
year
date
,
gender
char
(
1
))
DISTRIBUTED
BY
(
id
,
gender
,
year
)
partition
by
list
(
gender
)
(
partition
boys
values
(
'M'
),
partition
girls
values
(
'a'
),
partition
girls
values
(
'b'
),
partition
girls
values
(
'c'
),
partition
girls
values
(
'd'
),
partition
girls
values
(
'e'
),
partition
bob
values
(
'M'
)
);
-- duplicate values
CREATE
TABLE
rank
(
id
int
,
rank
int
,
year
date
,
gender
char
(
1
))
DISTRIBUTED
BY
(
id
,
gender
,
year
)
partition
by
list
(
rank
,
gender
)
(
values
(
1
,
'M'
),
values
(
2
,
'M'
),
values
(
3
,
'M'
),
values
(
1
,
'F'
),
partition
ff
values
(
4
,
'M'
),
partition
bb
values
(
1
,
'M'
)
);
-- legal if end of aa not inclusive
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
))
distributed
by
(
a
)
partition
by
range
(
b
)
(
partition
aa
start
(
date
'2007-01-01'
)
end
(
date
'2008-01-01'
),
partition
bb
start
(
date
'2008-01-01'
)
end
(
date
'2009-01-01'
)
every
(
interval
'10 days'
));
drop
table
ggg
cascade
;
-- bad - legal if end of aa not inclusive
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
))
distributed
by
(
a
)
partition
by
range
(
b
)
(
partition
aa
start
(
date
'2007-01-01'
)
end
(
date
'2008-01-01'
)
inclusive
,
partition
bb
start
(
date
'2008-01-01'
)
end
(
date
'2009-01-01'
)
every
(
interval
'10 days'
));
drop
table
ggg
cascade
;
-- legal because start of bb not inclusive
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
))
distributed
by
(
a
)
partition
by
range
(
b
)
(
partition
aa
start
(
date
'2007-01-01'
)
end
(
date
'2008-01-01'
)
inclusive
,
partition
bb
start
(
date
'2008-01-01'
)
exclusive
end
(
date
'2009-01-01'
)
every
(
interval
'10 days'
));
drop
table
ggg
cascade
;
-- legal if end of aa not inclusive
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
))
distributed
by
(
a
)
partition
by
range
(
b
)
(
partition
bb
start
(
date
'2008-01-01'
)
end
(
date
'2009-01-01'
),
partition
aa
start
(
date
'2007-01-01'
)
end
(
date
'2008-01-01'
)
);
drop
table
ggg
cascade
;
-- bad - legal if end of aa not inclusive
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
))
distributed
by
(
a
)
partition
by
range
(
b
)
(
partition
bb
start
(
date
'2008-01-01'
)
end
(
date
'2009-01-01'
),
partition
aa
start
(
date
'2007-01-01'
)
end
(
date
'2008-01-01'
)
inclusive
);
drop
table
ggg
cascade
;
-- legal because start of bb not inclusive
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
))
distributed
by
(
a
)
partition
by
range
(
b
)
(
partition
bb
start
(
date
'2008-01-01'
)
exclusive
end
(
date
'2009-01-01'
),
partition
aa
start
(
date
'2007-01-01'
)
end
(
date
'2008-01-01'
)
inclusive
);
drop
table
ggg
cascade
;
-- validate aa - start greater than end
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
))
distributed
by
(
a
)
partition
by
range
(
b
)
(
partition
bb
start
(
date
'2008-01-01'
)
end
(
date
'2009-01-01'
),
partition
aa
start
(
date
'2007-01-01'
)
end
(
date
'2006-01-01'
)
);
drop
table
ggg
cascade
;
-- cannot set end of first partition because next is before
create
table
ggg
(
a
char
(
1
),
b
date
,
d
char
(
3
))
distributed
by
(
a
)
partition
by
range
(
b
)
(
partition
bb
start
(
date
'2008-01-01'
)
,
partition
aa
start
(
date
'2007-01-01'
)
);
drop
table
ggg
cascade
;
-- the documentation example, rewritten with EVERY in a template
CREATE
TABLE
rank
(
id
int
,
rank
int
,
year
date
,
gender
char
(
1
))
DISTRIBUTED
BY
(
id
,
gender
,
year
)
partition
by
list
(
gender
)
subpartition
by
range
(
year
)
subpartition
template
(
start
(
date
'2001-01-01'
)
end
(
date
'2006-01-01'
)
every
(
interval
'1 year'
))
(
partition
boys
values
(
'M'
),
partition
girls
values
(
'F'
)
);
insert
into
rank
values
(
1
,
1
,
date
'2001-01-15'
,
'M'
);
insert
into
rank
values
(
2
,
1
,
date
'2002-02-15'
,
'M'
);
insert
into
rank
values
(
3
,
1
,
date
'2003-03-15'
,
'M'
);
insert
into
rank
values
(
4
,
1
,
date
'2004-04-15'
,
'M'
);
insert
into
rank
values
(
5
,
1
,
date
'2005-05-15'
,
'M'
);
insert
into
rank
values
(
6
,
1
,
date
'2001-01-15'
,
'F'
);
insert
into
rank
values
(
7
,
1
,
date
'2002-02-15'
,
'F'
);
insert
into
rank
values
(
8
,
1
,
date
'2003-03-15'
,
'F'
);
insert
into
rank
values
(
9
,
1
,
date
'2004-04-15'
,
'F'
);
insert
into
rank
values
(
10
,
1
,
date
'2005-05-15'
,
'F'
);
select
*
from
rank
;
select
*
from
rank_1_prt_boys
;
select
*
from
rank_1_prt_girls
;
select
*
from
rank_1_prt_boys_2_prt_1
;
select
*
from
rank_1_prt_boys_2_prt_2
;
select
*
from
rank_1_prt_girls_2_prt_1
;
select
*
from
rank_1_prt_girls_2_prt_2
;
drop
table
rank
cascade
;
-- integer ranges work too
create
table
ggg
(
id
integer
,
a
integer
)
distributed
by
(
id
)
partition
by
range
(
a
)
(
start
(
1
)
end
(
10
)
every
(
1
));
insert
into
ggg
values
(
1
,
1
);
insert
into
ggg
values
(
2
,
2
);
insert
into
ggg
values
(
3
,
3
);
insert
into
ggg
values
(
4
,
4
);
insert
into
ggg
values
(
5
,
5
);
insert
into
ggg
values
(
6
,
6
);
insert
into
ggg
values
(
7
,
7
);
insert
into
ggg
values
(
8
,
8
);
insert
into
ggg
values
(
9
,
9
);
insert
into
ggg
values
(
10
,
10
);
select
*
from
ggg
;
select
*
from
ggg_1_prt_1
;
select
*
from
ggg_1_prt_2
;
select
*
from
ggg_1_prt_3
;
select
*
from
ggg_1_prt_4
;
drop
table
ggg
cascade
;
-- hash tests
create
table
ggg
(
a
char
(
1
),
b
varchar
(
2
),
d
varchar
(
2
))
distributed
by
(
a
)
partition
by
hash
(
b
)
partitions
3
;
insert
into
ggg
values
(
1
,
1
,
1
);
insert
into
ggg
values
(
2
,
2
,
1
);
insert
into
ggg
values
(
1
,
3
,
1
);
insert
into
ggg
values
(
2
,
2
,
3
);
insert
into
ggg
values
(
1
,
4
,
5
);
insert
into
ggg
values
(
2
,
2
,
4
);
insert
into
ggg
values
(
1
,
5
,
6
);
insert
into
ggg
values
(
2
,
7
,
3
);
insert
into
ggg
values
(
1
,
'a'
,
'b'
);
insert
into
ggg
values
(
2
,
'c'
,
'c'
);
select
*
from
ggg
;
select
*
from
ggg_1_prt_1
;
select
*
from
ggg_1_prt_2
;
select
*
from
ggg_1_prt_3
;
drop
table
ggg
cascade
;
-- use multiple cols
create
table
ggg
(
a
char
(
1
),
b
varchar
(
2
),
d
varchar
(
2
))
distributed
by
(
a
)
partition
by
hash
(
b
,
d
)
partitions
3
;
insert
into
ggg
values
(
1
,
1
,
1
);
insert
into
ggg
values
(
2
,
2
,
1
);
insert
into
ggg
values
(
1
,
3
,
1
);
insert
into
ggg
values
(
2
,
2
,
3
);
insert
into
ggg
values
(
1
,
4
,
5
);
insert
into
ggg
values
(
2
,
2
,
4
);
insert
into
ggg
values
(
1
,
5
,
6
);
insert
into
ggg
values
(
2
,
7
,
3
);
insert
into
ggg
values
(
1
,
'a'
,
'b'
);
insert
into
ggg
values
(
2
,
'c'
,
'c'
);
select
*
from
ggg
;
select
*
from
ggg_1_prt_1
;
select
*
from
ggg_1_prt_2
;
select
*
from
ggg_1_prt_3
;
drop
table
ggg
cascade
;
-- use multiple cols of different types
create
table
ggg
(
a
char
(
1
),
b
varchar
(
2
),
d
integer
,
e
date
)
distributed
by
(
a
)
partition
by
hash
(
b
,
d
,
e
)
partitions
3
;
insert
into
ggg
values
(
1
,
1
,
1
,
date
'2001-01-15'
);
insert
into
ggg
values
(
2
,
2
,
1
,
date
'2001-01-15'
);
insert
into
ggg
values
(
1
,
3
,
1
,
date
'2001-01-15'
);
insert
into
ggg
values
(
2
,
2
,
3
,
date
'2001-01-15'
);
insert
into
ggg
values
(
1
,
4
,
5
,
date
'2001-01-15'
);
insert
into
ggg
values
(
2
,
2
,
4
,
date
'2001-01-15'
);
insert
into
ggg
values
(
1
,
5
,
6
,
date
'2001-01-15'
);
insert
into
ggg
values
(
2
,
7
,
3
,
date
'2001-01-15'
);
insert
into
ggg
values
(
1
,
'a'
,
33
,
date
'2001-01-15'
);
insert
into
ggg
values
(
2
,
'c'
,
44
,
date
'2001-01-15'
);
select
*
from
ggg
;
select
*
from
ggg_1_prt_1
;
select
*
from
ggg_1_prt_2
;
select
*
from
ggg_1_prt_3
;
drop
table
ggg
cascade
;
create
table
mpp_2914A
(
id
int
,
buyDate
date
,
kind
char
(
1
))
DISTRIBUTED
BY
(
id
)
partition
by
list
(
kind
)
subpartition
by
range
(
buyDate
)
subpartition
template
(
start
(
date
'2001-01-01'
),
start
(
date
'2002-01-01'
),
start
(
date
'2003-01-01'
),
start
(
date
'2004-01-01'
),
start
(
date
'2005-01-01'
)
)
(
partition
auction
values
(
'a'
,
'A'
),
partition
buyItNow
values
(
'b'
,
'B'
),
default
partition
catchall
);
\
d
mpp_2914a
*
select
count
(
*
)
from
mpp_2914A
;
create
table
mpp_2914B
(
id
int
,
buyDate
date
,
kind
char
(
1
))
DISTRIBUTED
BY
(
id
)
partition
by
list
(
kind
)
subpartition
by
range
(
buyDate
)
(
partition
auction
values
(
'a'
,
'A'
)
(
subpartition
y2001
start
(
date
'2001-01-01'
),
subpartition
y2002
start
(
date
'2002-01-01'
),
subpartition
y2003
start
(
date
'2003-01-01'
),
subpartition
y2004
start
(
date
'2004-01-01'
),
subpartition
y2005
start
(
date
'2005-01-01'
)
),
partition
buyitnow
values
(
'b'
,
'B'
)
(
subpartition
y2001
start
(
date
'2001-01-01'
),
subpartition
y2002
start
(
date
'2002-01-01'
),
subpartition
y2003
start
(
date
'2003-01-01'
),
subpartition
y2004
start
(
date
'2004-01-01'
),
subpartition
y2005
start
(
date
'2005-01-01'
)
),
default
partition
catchAll
(
subpartition
y2001
start
(
date
'2001-01-01'
),
subpartition
y2002
start
(
date
'2002-01-01'
),
subpartition
y2003
start
(
date
'2003-01-01'
),
subpartition
y2004
start
(
date
'2004-01-01'
),
subpartition
y2005
start
(
date
'2005-01-01'
)
)
);
\
d
mpp_2914b
*
select
count
(
*
)
from
mpp_2914B
;
drop
table
mpp_2914a
cascade
;
drop
table
mpp_2914b
cascade
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录