mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
tests
This commit is contained in:
parent
04504ccf7b
commit
66ae943899
@ -0,0 +1,16 @@
|
||||
{prefix}
|
||||
n: "123", s1: qwe,rty, s2: 'as"df\'gh', s3: "", s4: "zx
|
||||
cv bn m", d: 2016-01-01, n: 123 ;
|
||||
n: "456", s1: as"df\'gh, s2: '', s3: "zx\ncv\tbn m", s4: "qwe,rty", d: 2016-01-02, n: 456 ;
|
||||
n: "9876543210", s1: , s2: 'zx\ncv\tbn m', s3: "qwe,rty", s4: "as""df'gh", d: 2016-01-03, n: 9876543210 ;
|
||||
n: "789", s1: zx\ncv\tbn m, s2: 'qwe,rty', s3: "as\"df'gh", s4: "", d: 2016-01-04, n: 789
|
||||
------
|
||||
n: "0", s1: , s2: '', s3: "", s4: "", d: 0000-00-00, n: 0
|
||||
------
|
||||
n: "123", s1: , s2: '', s3: "", s4: "", d: 2016-01-01, n: 123
|
||||
------
|
||||
n: "9876543210", s1: zx\ncv\tbn m, s2: 'zx\ncv\tbn m', s3: "zx\ncv\tbn m", s4: "zx
|
||||
cv bn m", d: 2016-01-04, n: 9876543210
|
||||
4 rows
|
||||
before limit 4
|
||||
read 4 $ suffix $
|
@ -0,0 +1,12 @@
|
||||
DROP TABLE IF EXISTS test.template;
|
||||
CREATE TABLE test.template (s1 String, s2 String, s3 String, s4 String, n UInt64, d Date) ENGINE = Memory;
|
||||
INSERT INTO test.template VALUES
|
||||
('qwe,rty', 'as"df''gh', '', 'zx\ncv\tbn m', 123, '2016-01-01'),('as"df''gh', '', 'zx\ncv\tbn m', 'qwe,rty', 456, '2016-01-02'),('', 'zx\ncv\tbn m', 'qwe,rty', 'as"df''gh', 9876543210, '2016-01-03'),('zx\ncv\tbn m', 'qwe,rty', 'as"df''gh', '', 789, '2016-01-04');
|
||||
|
||||
SELECT * FROM test.template WITH TOTALS LIMIT 4 FORMAT Template SETTINGS
|
||||
extremes = 1,
|
||||
format_schema = '{prefix} \n${data}\n------\n${totals:}\n------\n${min}\n------\n${max}\n${rows:} rows\nbefore limit ${rows_before_limit:XML}\nread ${rows_read} $$ suffix $$',
|
||||
format_schema_rows = 'n:\t${n:JSON}, s1:\t${s1:Escaped}, s2:\t${s2:Quoted}, s3:\t${s3:JSON}, s4:\t${s4:CSV}, d:\t${d}, n:\t${n:Raw}\t',
|
||||
format_schema_rows_between_delimiter = ';\n';
|
||||
|
||||
DROP TABLE test.template;
|
@ -0,0 +1,8 @@
|
||||
"qwe,rty","as""df'gh","","zx
|
||||
cv bn m",123,"2016-01-01"
|
||||
"as""df'gh","","zx
|
||||
cv bn m","qwe,rty",456,"2016-01-02"
|
||||
"zx
|
||||
cv bn m","qwe,rty","as""df'gh","",789,"2016-01-04"
|
||||
"","zx
|
||||
cv bn m","qwe,rty","as""df'gh",9876543210,"2016-01-03"
|
18
dbms/tests/queries/0_stateless/00938_template_input_format.sh
Executable file
18
dbms/tests/queries/0_stateless/00938_template_input_format.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
||||
. $CURDIR/../shell_config.sh
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE IF EXISTS test.template";
|
||||
$CLICKHOUSE_CLIENT --query="CREATE TABLE test.template (s1 String, s2 String, s3 String, s4 String, n UInt64, d Date) ENGINE = Memory";
|
||||
|
||||
echo "{prefix}
|
||||
n: 123, s1: qwe,rty , s2: 'as\"df\\'gh', s3: \"\", s4: \"zx
|
||||
cv bn m\", d: 2016-01-01 ;
|
||||
n: 456, s1: as\"df\\'gh , s2: '', s3: \"zx\\ncv\\tbn m\", s4: \"qwe,rty\", d: 2016-01-02 ;
|
||||
n: 9876543210, s1: , s2: 'zx\\ncv\\tbn m', s3: \"qwe,rty\", s4: \"as\"\"df'gh\", d: 2016-01-03 ;
|
||||
n: 789, s1: zx\\ncv\\tbn m , s2: 'qwe,rty', s3: \"as\\\"df'gh\", s4: \"\", d: 2016-01-04
|
||||
$ suffix $" | $CLICKHOUSE_CLIENT --query="INSERT INTO test.template FORMAT Template SETTINGS format_schema = '{prefix} \n\${data}\n \$\$ suffix \$\$\n', format_schema_rows = 'n:\t\${n}, s1:\t\${s1:Escaped}\t, s2:\t\${s2:Quoted}, s3:\t\${s3:JSON}, s4:\t\${s4:CSV}, d:\t\${d}\t', format_schema_rows_between_delimiter = ';\n'";
|
||||
|
||||
$CLICKHOUSE_CLIENT --query="SELECT * FROM test.template ORDER BY n FORMAT CSV";
|
||||
$CLICKHOUSE_CLIENT --query="DROP TABLE test.template";
|
Loading…
Reference in New Issue
Block a user