File: test_windows_newline.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 (49 lines) | stat: -rw-r--r-- 1,110 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
# name: test/sql/copy/csv/test_windows_newline.test
# description: Test Windows Newlines with a long file
# group: [csv]

statement ok
PRAGMA enable_verification

# many strings with windows newlines
# load CSV file into a table
statement ok
CREATE TABLE test (a INTEGER, b VARCHAR, c INTEGER);

query I
COPY test FROM '{DATA_DIR}/csv/test/windows_newline.csv';
----
20000

query RIIRR
SELECT SUM(a), MIN(LENGTH(b)), MAX(LENGTH(b)), SUM(LENGTH(b)), SUM(c) FROM test;
----
199990000.000000	5	5	100000.000000	200030000.000000

statement ok
DELETE FROM test;

# now do the same with a multi-byte quote that is not actually used
statement error
COPY test FROM '{DATA_DIR}/csv/test/windows_newline.csv' (QUOTE 'BLABLABLA', AUTO_DETECT FALSE);
----
The quote option cannot exceed a size of 1 byte.

statement ok
DROP TABLE test;

# csv file with one value and many empty values with windows newline
# load CSV file into a table
statement ok
CREATE TABLE test (a INTEGER);

query I
COPY test FROM '{DATA_DIR}/csv/test/windows_newline_empty.csv' (HEADER 0);
----
20000

query R
SELECT SUM(a) FROM test;
----
1.000000