File: test_lineitem.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 (55 lines) | stat: -rw-r--r-- 1,676 bytes parent folder | download | duplicates (4)
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
# name: test/sql/copy/csv/test_lineitem.test
# description: Test copy from/to lineitem csv
# group: [csv]

statement ok
PRAGMA enable_verification

statement ok
CREATE TABLE lineitem(l_orderkey INT NOT NULL, l_partkey INT NOT NULL, l_suppkey INT NOT NULL, l_linenumber INT NOT NULL, l_quantity INTEGER NOT NULL, l_extendedprice DECIMAL(15,2) NOT NULL, l_discount DECIMAL(15,2) NOT NULL, l_tax DECIMAL(15,2) NOT NULL, l_returnflag VARCHAR(1) NOT NULL, l_linestatus VARCHAR(1) NOT NULL, l_shipdate DATE NOT NULL, l_commitdate DATE NOT NULL, l_receiptdate DATE NOT NULL, l_shipinstruct VARCHAR(25) NOT NULL, l_shipmode VARCHAR(10) NOT NULL, l_comment VARCHAR(44) NOT NULL);

query I
COPY lineitem FROM '{DATA_DIR}/csv/real/lineitem_sample.csv' DELIMITER '|'
----
10

query IT
SELECT l_partkey, l_comment FROM lineitem WHERE l_orderkey=1 ORDER BY l_linenumber;
----
15519	egular courts above the
6731	ly final dependencies: slyly bold 
6370	riously. regular, express dep
214	lites. fluffily even de
2403	 pending foxes. slyly re
1564	arefully slyly ex

# test COPY ... TO ... with HEADER
query I
COPY lineitem TO '{TEMP_DIR}/lineitem.csv' (DELIMITER ' ', HEADER);
----
10

# clear the table
statement ok
DELETE FROM lineitem;

query IIIIIRRRTTTTTTTT
SELECT * FROM lineitem;
----

# now copy back into the table
query I
COPY lineitem FROM '{TEMP_DIR}/lineitem.csv' DELIMITER ' ' HEADER;
----
10

query IT
SELECT l_partkey, l_comment FROM lineitem WHERE l_orderkey=1 ORDER BY l_linenumber;
----
15519	egular courts above the
6731	ly final dependencies: slyly bold 
6370	riously. regular, express dep
214	lites. fluffily even de
2403	 pending foxes. slyly re
1564	arefully slyly ex