File: relaxed_quotes.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 (136 lines) | stat: -rw-r--r-- 4,802 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
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
# name: test/sql/copy/csv/relaxed_quotes.test
# description: Test relaxed quote reading
# group: [csv]

statement ok
PRAGMA enable_verification

query IIII
from read_csv('{DATA_DIR}/csv/unescaped_quotes/stops.csv');
----
"de:08115:1303:2:1"	"Weil der Stadt Bahnhof"	"48.7551432936956"	"8.87272294455349"
"de:08115:1303:2:4"	"Weil der Stadt Bahnhof"	"48.7542193911232"	"8.87191446079767"
"de:08115:4574:0:1"	"Weil der Stadt Stadtgarten"	"48.7523774577301"	"8.869444093766"
"de:08115:4574:0:2"	"Weil der Stadt Stadtgarten"	"48.7523774577301"	"8.869444093766"
"de:08115:4575:0:1"	"Weil der Stadt Merklinger Straße"	"48.7554808692434"	"8.86798882300553"
"de:08115:4575:0:2"	"Weil der Stadt Merklinger Straße"	"48.7554808692434"	"8.86798882300553"
"de:08115:4577:0:1"	"Münklingen Neuhauser Str."	"48.7769389105929"	"8.81035291436839"
"de:08317:12007:2:1"	"Lahr Schlüssel "Vis-à-Vis Bus" more text"	"48.3411985847104"	"7.87932997062448"
"de:08317:12007:2:1"	"Lahr Schlüssel "Vis-à-Vis Bus""	"48.3411985847104"	"7.87932997062448"

query IIII
from read_csv('{DATA_DIR}/csv/unescaped_quotes/stops.csv', strict_mode=false);
----
de:08115:1303:2:1	Weil der Stadt Bahnhof	48.7551432936956	8.87272294455349
de:08115:1303:2:4	Weil der Stadt Bahnhof	48.7542193911232	8.87191446079767
de:08115:4574:0:1	Weil der Stadt Stadtgarten	48.7523774577301	8.869444093766
de:08115:4574:0:2	Weil der Stadt Stadtgarten	48.7523774577301	8.869444093766
de:08115:4575:0:1	Weil der Stadt Merklinger Straße	48.7554808692434	8.86798882300553
de:08115:4575:0:2	Weil der Stadt Merklinger Straße	48.7554808692434	8.86798882300553
de:08115:4577:0:1	Münklingen Neuhauser Str.	48.7769389105929	8.81035291436839
de:08317:12007:2:1	Lahr Schlüssel "Vis-à-Vis Bus" more text	48.3411985847104	7.87932997062448
de:08317:12007:2:1	Lahr Schlüssel "Vis-à-Vis Bus"	48.3411985847104	7.87932997062448

query II
from read_csv('{DATA_DIR}/csv/unescaped_quotes/unescaped_quote.csv', escape = '"', strict_mode=false);
----
1	pedro pdet holanda
2	pedro pdet holanda
3	pedro pdet ho;landa
4	pedro pdet holanda
5	pedro pdet holanda
6	pedro pdet holanda

query II
from read_csv('{DATA_DIR}/csv/unescaped_quotes/unescaped_quote.csv', strict_mode=false, escape = '', quote = '"', delim = ';');
----
1	pedro "pdet" holanda
2	pedro "pdet" holanda
3	pedro "pdet" ho;landa
4	pedro "pdet" holanda
5	pedro "pdet" holanda
6	pedro "pdet" holanda


loop buffer_size 30 35

query II
from read_csv('{DATA_DIR}/csv/unescaped_quotes/unescaped_quote.csv', strict_mode=false, escape = '', buffer_size = ${buffer_size}, header = 0)
----
1	pedro "pdet" holanda
2	pedro "pdet" holanda
3	pedro "pdet" ho;landa
4	pedro "pdet" holanda
5	pedro "pdet" holanda
6	pedro "pdet" holanda

endloop

statement ok
create table t as from read_csv('{DATA_DIR}/csv/unescaped_quotes/unescaped_quote_new_line.csv', strict_mode=false, header = 0)

query I
select count(*) from t;
----
6

statement ok
drop table t;

statement error
create table t as from read_csv('{DATA_DIR}/csv/unescaped_quotes/unescaped_quote_new_line_rn.csv', strict_mode=false, buffer_size = 20, header = 0, delim = ';')
----

statement ok
create table t as from read_csv('{DATA_DIR}/csv/unescaped_quotes/unescaped_quote_new_line.csv', strict_mode=false, buffer_size = 30, header = 0, parallel = false)

statement ok
drop table t

statement ok
create table t as from read_csv('{DATA_DIR}/csv/unescaped_quotes/unescaped_quote_new_line_rn.csv', strict_mode=false, buffer_size = 30, header = 0, parallel = false)


query I
FROM read_csv('{DATA_DIR}/csv/unescaped_quotes/end_quote.csv', columns = {'a':'varchar'}, header = false, quote = '"', strict_mode = false)
----
Pedro "the" legend
Pedro "the

query I
FROM read_csv('{DATA_DIR}/csv/unescaped_quotes/end_quote.csv', columns = {'a':'varchar'}, header = false, quote = '"', strict_mode = false)
----
Pedro "the" legend
Pedro "the


query I
FROM read_csv('{DATA_DIR}/csv/unescaped_quotes/end_quote_2.csv', columns = {'a':'varchar'}, header = false, quote = '"', strict_mode = false)
----
Pedro "the" legend
Pedro "the
Pedro "the

query I
FROM read_csv('{DATA_DIR}/csv/unescaped_quotes/end_quote_3.csv', columns = {'a':'varchar'}, header = false, quote = '"', strict_mode = false)
----
Pedro "the
Pedro "the" legend
Pedro "the

# What happens when we mix everything
query I
FROM read_csv('{DATA_DIR}/csv/unescaped_quotes/some_escaped_some_not.csv', columns = {'a':'varchar'}, header = false, quote = '"', escape = '"', strict_mode = false)
----
Pedro "the" legend
Pedro the legend
Pedro "the
Pedro the

# It is not possible to read this with escape set.
query I
FROM read_csv('{DATA_DIR}/csv/unescaped_quotes/end_quote_mixed.csv', columns = {'a':'varchar'}, header = false, quote = '"', escape = '', strict_mode = false)
----
Pedro "the
Pedro ""the"" legend
Pedro "the