File: unzip.test

package info (click to toggle)
duckdb 1.5.1-3
  • 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: 564
file content (71 lines) | stat: -rw-r--r-- 1,570 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
# name: test/sql/storage/unzip.test
# description: Support gzipped files in the test runner
# group: [storage]

# data/storage/index_0-9-1.db was written with a 64-bit version of duckdb
require 64bit

# The database is written with a vector size of 2048.
require vector_size 2048

statement ok
PRAGMA enable_verification

# unzip to specific path
unzip data/storage/test.db.gz __TEST_DIR__/test.db

load  __TEST_DIR__/test.db readonly

query I
SELECT a+1 FROM tbl;
----
6

# unzip a 1.8M file into the default extraction path -> __TEST_DIR__/
unzip data/storage/index_0-9-1.db.gz

load __TEST_DIR__/index_0-9-1.db readonly

query II
SELECT table_name, index_count FROM duckdb_tables() ORDER BY table_name;
----
fk_tbl	1
idx_tbl	2
pk_tbl	2

# unzip to default extraction path from NULL input
unzip data/storage/test.db.gz NULL

load __TEST_DIR__/test.db readonly

query I
SELECT a+2 FROM tbl;
----
7

## test invalid use
# unzip

## not gzipped database
# unzip data/storage/test.db

## not gzipped database
# unzip data/storage/test.db

## test NULL input paths
# unzip NULL
# unzip NULL NULL
# unzip NULL data/storage/test.db

## invalid input path
# unzip path/to/nowhere data/storage/not_existed.db

## invalid extraction path
# unzip data/storage/test.db.gz path/to/nowhere

## already existed database file in the extraction - warning: this will overwrite existed wal_test_092.db
# unzip data/storage/test.db.gz data/storage/wal_test_092.db

## extraction path to directory
# unzip data/storage/test.db.gz __TEST_DIR__/
# unzip data/storage/test.db.gz __TEST_DIR__