-
Notifications
You must be signed in to change notification settings - Fork 633
/
Copy pathiceberg_engine.slt
116 lines (96 loc) · 4.54 KB
/
iceberg_engine.slt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
statement ok
set sink_decouple = false;
statement ok
create table t(id int primary key, name varchar) with(commit_checkpoint_interval = 1) engine = iceberg;
statement ok
insert into t values(1, 'xxx');
statement ok
FLUSH;
query ??
select * from t;
----
1 xxx
query ??
select * from t for system_time as of '2222-12-10 11:48:06';
----
1 xxx
statement ok
DROP TABLE t;
statement ok
CREATE TABLE full_type_t (
id bigint primary key,
v_small_int smallint,
v_int int,
v_long bigint,
v_float real,
v_double double,
v_varchar varchar,
v_bool boolean,
v_date date,
v_timestamp timestamptz,
v_ts_ntz timestamp,
v_timestamp_ns timestamp_ns,
v_decimal decimal,
v_map map(int, int),
v_array int[],
v_struct struct<a int,b int>,
v_json jsonb,
v_one_layer_struct struct<id bigint, v_small_int smallint, v_int int, v_long bigint, v_float real, v_double double, v_varchar varchar, v_bool boolean, v_date date, v_timestamp timestamptz, v_ts_ntz timestamp, v_decimal decimal, v_json jsonb>,
v_nested_type struct<a int, b map(int, int)>[]
) with(commit_checkpoint_interval = 1) engine = iceberg;
statement ok
INSERT INTO full_type_t VALUES
(1, 1, 1, 1000, 1.1, 1.11, '1-1', true, '2022-03-11', '2022-03-11 01:00:00Z'::timestamptz, '2022-03-11 01:00:00',1.11, map {1:100,2:200}, array[1,2,3], row(1,2), '{"a":"foo", "b":"bar"}', row(1, 1, 1, 1000, 1.1, 1.11, '1-1', true, '2022-03-11', '2022-03-11 01:00:00Z'::timestamptz, '2022-03-11 01:00:00',1.11, '{"a":"foo", "b":"bar"}'), array[row(1,map {1:100,2:200}), row(2,map {3:500,4:200})]),
(2, 2, 2, 2000, 2.2, 2.22, '2-2', false, '2022-03-12', '2022-03-12 02:00:00Z'::timestamptz, '2022-03-12 02:00:00',2.22, map {3:300}, array[1,null,3], row(3,null), '{"k2":[2,true,4]}', row(2, 2, 2, 2000, 2.2, 2.22, '2-2', false, '2022-03-12', '2022-03-12 02:00:00Z'::timestamptz, '2022-03-12 02:00:00',2.22, '{"k2":[2,true,4]}'), array[]::struct<a int, b map (int, int)>[]),
(3, 3, 3, 3000, 3.3, 3.33, '3-3', true, '2022-03-13', '2022-03-13 03:00:00Z'::timestamptz, '2022-03-13 03:00:00','inf', null, null, null, '1', row(3, 3, 3, 3000, 3.3, 3.33, '3-3', true, '2022-03-13', '2022-03-13 03:00:00Z'::timestamptz, '2022-03-13 03:00:00','inf', '1'), array[row(1,map {1:100,2:200})]),
(4, 4, 4, 4000, 4.4, 4.44, '4-4', false, '2022-03-14', '2022-03-14 04:00:00Z'::timestamptz, '2022-03-14 04:00:00','-inf', null, null, null, 'true', row(4, 4, 4, 4000, 4.4, 4.44, '4-4', false, '2022-03-14', '2022-03-14 04:00:00Z'::timestamptz, '2022-03-14 04:00:00','-inf', 'true'), null);
statement ok
FLUSH;
query ????????????????? rowsort
select * from full_type_t
----
1 1 1 1000 1.1 1.11 1-1 t 2022-03-11 2022-03-11 01:00:00+00:00 2022-03-11 01:00:00 1.1100000000 {1:100,2:200} {1,2,3} (1,2) {"a": "foo", "b": "bar"} (1,1,1,1000,1.1,1.11,1-1,t,2022-03-11,"2022-03-11 01:00:00+00:00","2022-03-11 01:00:00",1.1100000000,"{""a"": ""foo"", ""b"": ""bar""}") {"(1,\"{1:100,2:200}\")","(2,\"{3:500,4:200}\")"}
2 2 2 2000 2.2 2.22 2-2 f 2022-03-12 2022-03-12 02:00:00+00:00 2022-03-12 02:00:00 2.2200000000 {3:300} {1,NULL,3} (3,) {"k2": [2, true, 4]} (2,2,2,2000,2.2,2.22,2-2,f,2022-03-12,"2022-03-12 02:00:00+00:00","2022-03-12 02:00:00",2.2200000000,"{""k2"": [2, true, 4]}") {}
3 3 3 3000 3.3 3.33 3-3 t 2022-03-13 2022-03-13 03:00:00+00:00 2022-03-13 03:00:00 999999999999999999.9999999999 NULL NULL NULL 1 (3,3,3,3000,3.3,3.33,3-3,t,2022-03-13,"2022-03-13 03:00:00+00:00","2022-03-13 03:00:00",999999999999999999.9999999999,1) {"(1,\"{1:100,2:200}\")"}
4 4 4 4000 4.4 4.44 4-4 f 2022-03-14 2022-03-14 04:00:00+00:00 2022-03-14 04:00:00 -999999999999999999.9999999999 NULL NULL NULL true (4,4,4,4000,4.4,4.44,4-4,f,2022-03-14,"2022-03-14 04:00:00+00:00","2022-03-14 04:00:00",-999999999999999999.9999999999,true) NULL
statement ok
DROP TABLE full_type_t;
# test connector with commit_checkpoint_interval
statement ok
create table nexmark_t (
id BIGINT,
item_name VARCHAR,
description VARCHAR,
initial_bid BIGINT,
reserve BIGINT,
date_time TIMESTAMP,
expires TIMESTAMP,
seller BIGINT,
category BIGINT,
extra VARCHAR)
with (
connector = 'nexmark',
nexmark.table.type = 'Auction',
nexmark.split.num = '2',
nexmark.min.event.gap.in.ns = '500000',
commit_checkpoint_interval = 1
) engine = iceberg;
statement ok
DROP TABLE nexmark_t
# test hidden _row_id column for iceberg engine table
statement ok
create table t_without_pk(name varchar) with(commit_checkpoint_interval = 1) engine = iceberg;
statement ok
insert into t_without_pk values('xxx');
statement ok
FLUSH;
query ?
select * from t_without_pk;
----
xxx
query ?
select count(_row_id) from t_without_pk;
----
1
statement ok
DROP TABLE t_without_pk