mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 02:21:59 +00:00
dbms: fixed error; added tests [#METR-19957].
This commit is contained in:
parent
43c73cf7ee
commit
73994ebb08
@ -61,7 +61,9 @@ public:
|
||||
|
||||
void deserializeTextCSV(Field & field, ReadBuffer & istr, const char delimiter) const override
|
||||
{
|
||||
deserializeText(field, istr);
|
||||
typename NearestFieldType<FieldType>::Type x;
|
||||
readCSV(x, istr);
|
||||
field = x;
|
||||
}
|
||||
|
||||
size_t getSizeOfField() const override { return sizeof(FieldType); }
|
||||
|
15
dbms/tests/queries/0_stateless/00300_csv.reference
Normal file
15
dbms/tests/queries/0_stateless/00300_csv.reference
Normal file
@ -0,0 +1,15 @@
|
||||
"x","y","z","a","b"
|
||||
"Hello, ""World""",123,"[1,2,3]",456,"['abc','def']","Newline
|
||||
here"
|
||||
"Hello, ""World""",123,"[1,2,3]",456,"['abc','def']","Newline
|
||||
here"
|
||||
0,"0","[]","2000-01-01","2000-01-01 00:00:00"
|
||||
1,"1","[0]","2000-01-02","2000-01-01 00:00:01"
|
||||
2,"2","[0,1]","2000-01-03","2000-01-01 00:00:02"
|
||||
3,"3","[0,1,2]","2000-01-04","2000-01-01 00:00:03"
|
||||
4,"4","[0,1,2,3]","2000-01-05","2000-01-01 00:00:04"
|
||||
5,"5","[0,1,2,3,4]","2000-01-06","2000-01-01 00:00:05"
|
||||
6,"6","[0,1,2,3,4,5]","2000-01-07","2000-01-01 00:00:06"
|
||||
7,"7","[0,1,2,3,4,5,6]","2000-01-08","2000-01-01 00:00:07"
|
||||
8,"8","[0,1,2,3,4,5,6,7]","2000-01-09","2000-01-01 00:00:08"
|
||||
9,"9","[0,1,2,3,4,5,6,7,8]","2000-01-10","2000-01-01 00:00:09"
|
3
dbms/tests/queries/0_stateless/00300_csv.sql
Normal file
3
dbms/tests/queries/0_stateless/00300_csv.sql
Normal file
@ -0,0 +1,3 @@
|
||||
SELECT 'Hello, "World"' AS x, 123 AS y, [1, 2, 3] AS z, (456, ['abc', 'def']) AS a, 'Newline\nhere' AS b FORMAT CSVWithNames;
|
||||
SELECT 'Hello, "World"' AS x, 123 AS y, [1, 2, 3] AS z, (456, ['abc', 'def']) AS a, 'Newline\nhere' AS b FORMAT CSV;
|
||||
SELECT number, toString(number), range(number), toDate('2000-01-01') + number, toDateTime('2000-01-01 00:00:00') + number FROM system.numbers LIMIT 10 FORMAT CSV;
|
4
dbms/tests/queries/0_stateless/00301_csv.reference
Normal file
4
dbms/tests/queries/0_stateless/00301_csv.reference
Normal file
@ -0,0 +1,4 @@
|
||||
Hello, world 123 2016-01-01
|
||||
Hello, "world" 456 2016-01-02
|
||||
Hello "world" 789 2016-01-03
|
||||
Hello\n world 100 2016-01-04
|
13
dbms/tests/queries/0_stateless/00301_csv.sh
Executable file
13
dbms/tests/queries/0_stateless/00301_csv.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
clickhouse-client --query="DROP TABLE IF EXISTS test.csv";
|
||||
clickhouse-client --query="CREATE TABLE test.csv (s String, n UInt64, d Date) ENGINE = Memory";
|
||||
|
||||
echo '"Hello, world", 123, "2016-01-01"
|
||||
"Hello, ""world""", "456", 2016-01-02
|
||||
Hello "world", 789 ,2016-01-03
|
||||
"Hello
|
||||
world", 100, 2016-01-04' | clickhouse-client --query="INSERT INTO test.csv FORMAT CSV";
|
||||
|
||||
clickhouse-client --query="SELECT * FROM test.csv ORDER BY d";
|
||||
clickhouse-client --query="DROP TABLE test.csv";
|
Loading…
Reference in New Issue
Block a user