File: create_table_compression.test

package info (click to toggle)
duckdb 1.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 299,196 kB
  • sloc: cpp: 865,414; ansic: 57,292; python: 18,871; sql: 12,663; lisp: 11,751; yacc: 7,412; lex: 1,682; sh: 747; makefile: 558
file content (189 lines) | stat: -rw-r--r-- 2,827 bytes parent folder | download | duplicates (3)
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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# name: test/sql/create/create_table_compression.test
# description: Test CREATE TABLE using compression options
# group: [create]

# This test defaults to another compression function for smaller block sizes,
# because the bitpacking groups no longer fit the blocks.
require block_size 262144

require skip_reload

statement ok
PRAGMA enable_verification

statement ok
CREATE TABLE T (a INTEGER USING COMPRESSION RLE)

statement ok
DROP TABLE T

statement error
CREATE TABLE T (a INTEGER USING COMPRESSION 'bla')
----
unrecognized value

statement error
CREATE TABLE T (a INTEGER USING COMPRESSION )
----
Parser Error: syntax error at or near ")"

statement error
CREATE TABLE T (a INTEGER NOT NULL USING COMPRESSION )
----
Parser Error: syntax error at or near ")"

statement error
CREATE TABLE T (a INTEGER USING COMPRESSION bla)
----
unrecognized value

statement ok
CREATE TABLE T (a INTEGER NOT NULL USING COMPRESSION RLE)

statement ok
DROP TABLE T

statement ok
CREATE TABLE T (a INTEGER USING COMPRESSION RLE, b VARCHAR )

statement ok
DROP TABLE T

load __TEST_DIR__/test_compression_hint.db

statement ok
CREATE TABLE T (a INTEGER USING COMPRESSION RLE, b INTEGER USING COMPRESSION BITPACKING, C INTEGER USING COMPRESSION UNCOMPRESSED)

statement ok
INSERT INTO T VALUES (1,1,1), (1,1,1), (1,1,1), (2,2,2), (2,2,2), (3,3,3)

query III
SELECT * FROM T
----
1	1	1
1	1	1
1	1	1
2	2	2
2	2	2
3	3	3

restart

query III
SELECT * FROM T
----
1	1	1
1	1	1
1	1	1
2	2	2
2	2	2
3	3	3

statement ok
CHECKPOINT

query I
SELECT compression FROM pragma_storage_info('T') WHERE segment_type ILIKE 'INTEGER' LIMIT 3
----
RLE
BitPacking
Uncompressed

statement ok
ALTER TABLE T RENAME COLUMN a TO a_1

statement ok
ALTER TABLE T RENAME COLUMN b TO b_1

statement ok
ALTER TABLE T RENAME COLUMN c TO c_1

restart

query III
SELECT * FROM T
----
1	1	1
1	1	1
1	1	1
2	2	2
2	2	2
3	3	3

query I
SELECT compression FROM pragma_storage_info('T') WHERE segment_type ILIKE 'INTEGER' LIMIT 3
----
RLE
BitPacking
Uncompressed

statement ok
ALTER TABLE T RENAME TO T_1

restart

query III
SELECT * FROM T_1
----
1	1	1
1	1	1
1	1	1
2	2	2
2	2	2
3	3	3

query I
SELECT compression FROM pragma_storage_info('T_1') WHERE segment_type ILIKE 'INTEGER' LIMIT 3
----
RLE
BitPacking
Uncompressed

# Test Drop Column
statement ok
ALTER TABLE T_1 DROP COLUMN c_1

statement ok
ALTER TABLE T_1 DROP COLUMN b_1

restart

query I
SELECT * FROM T_1
----
1
1
1
2
2
3

query I
SELECT compression FROM pragma_storage_info('T_1') WHERE segment_type ILIKE 'INTEGER' LIMIT 2
----
RLE

# Test Add Column
statement ok
ALTER TABLE T_1 ADD COLUMN b INTEGER DEFAULT 2

restart

query II
SELECT * FROM T_1
----
1	2
1	2
1	2
2	2
2	2
3	2

statement ok
CHECKPOINT

query I
SELECT compression FROM pragma_storage_info('T_1') WHERE segment_type ILIKE 'INTEGER' LIMIT 3
----
RLE
Constant