mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-24 16:42:05 +00:00
decimal: add test for input/output formats CLICKHOUSE-3765
This commit is contained in:
parent
29d8d07975
commit
409562a397
@ -0,0 +1,36 @@
|
|||||||
|
{"a":0.100,"b":-0.100000000,"c":0.100000000000000000}
|
||||||
|
{"a":0.200,"b":-0.200000000,"c":0.200000000000000000}
|
||||||
|
{"a":0.300,"b":-0.300000000,"c":0.300000000000000000}
|
||||||
|
{"a":0.420,"b":-0.420000000,"c":0.420000000000000000}
|
||||||
|
{"a":1.000,"b":-1.000000000,"c":1.000000000000000000}
|
||||||
|
{"a":1.100,"b":-1.100000000,"c":1.100000000000000000}
|
||||||
|
{"a":2.000,"b":-2.000000000,"c":2.000000000000000000}
|
||||||
|
{"a":2.200,"b":-2.200000000,"c":2.200000000000000000}
|
||||||
|
{"a":3.000,"b":-3.000000000,"c":3.000000000000000000}
|
||||||
|
{"a":3.300,"b":-3.300000000,"c":3.300000000000000000}
|
||||||
|
{"a":42.000,"b":-42.000000000,"c":42.000000000000000000}
|
||||||
|
{"a":42.420,"b":-42.420000000,"c":42.420000000000000000}
|
||||||
|
0.100,-0.100000000,0.100000000000000000
|
||||||
|
0.200,-0.200000000,0.200000000000000000
|
||||||
|
0.300,-0.300000000,0.300000000000000000
|
||||||
|
0.420,-0.420000000,0.420000000000000000
|
||||||
|
1.000,-1.000000000,1.000000000000000000
|
||||||
|
1.100,-1.100000000,1.100000000000000000
|
||||||
|
2.000,-2.000000000,2.000000000000000000
|
||||||
|
2.200,-2.200000000,2.200000000000000000
|
||||||
|
3.000,-3.000000000,3.000000000000000000
|
||||||
|
3.300,-3.300000000,3.300000000000000000
|
||||||
|
42.000,-42.000000000,42.000000000000000000
|
||||||
|
42.420,-42.420000000,42.420000000000000000
|
||||||
|
0.100 -0.100000000 0.100000000000000000
|
||||||
|
0.200 -0.200000000 0.200000000000000000
|
||||||
|
0.300 -0.300000000 0.300000000000000000
|
||||||
|
0.420 -0.420000000 0.420000000000000000
|
||||||
|
1.000 -1.000000000 1.000000000000000000
|
||||||
|
1.100 -1.100000000 1.100000000000000000
|
||||||
|
2.000 -2.000000000 2.000000000000000000
|
||||||
|
2.200 -2.200000000 2.200000000000000000
|
||||||
|
3.000 -3.000000000 3.000000000000000000
|
||||||
|
3.300 -3.300000000 3.300000000000000000
|
||||||
|
42.000 -42.000000000 42.000000000000000000
|
||||||
|
42.420 -42.420000000 42.420000000000000000
|
31
dbms/tests/queries/0_stateless/00700_decimal_formats.sql
Normal file
31
dbms/tests/queries/0_stateless/00700_decimal_formats.sql
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
SET allow_experimental_decimal_type = 1;
|
||||||
|
CREATE DATABASE IF NOT EXISTS test;
|
||||||
|
DROP TABLE IF EXISTS test.decimal;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS test.decimal
|
||||||
|
(
|
||||||
|
a DEC(9, 3),
|
||||||
|
b DEC(18, 9),
|
||||||
|
c DEC(38, 18)
|
||||||
|
) ENGINE = Memory;
|
||||||
|
|
||||||
|
INSERT INTO test.decimal (a, b, c) VALUES (42.0, -42.0, 42) (0.42, -0.42, .42) (42.42, -42.42, 42.42);
|
||||||
|
INSERT INTO test.decimal (a, b, c) FORMAT JSONEachRow {"a":1.1, "b":-1.1, "c":1.1} {"a":1.0, "b":-1.0, "c":1} {"a":0.1, "b":-0.1, "c":.1};
|
||||||
|
INSERT INTO test.decimal (a, b, c) FORMAT CSV 2.0, -2.0, 2
|
||||||
|
;
|
||||||
|
INSERT INTO test.decimal (a, b, c) FORMAT CSV 0.2, -0.2, .2
|
||||||
|
;
|
||||||
|
INSERT INTO test.decimal (a, b, c) FORMAT CSV 2.2 , -2.2 , 2.2
|
||||||
|
;
|
||||||
|
INSERT INTO test.decimal (a, b, c) FORMAT TabSeparated 3.3 -3.3 3.3
|
||||||
|
;
|
||||||
|
INSERT INTO test.decimal (a, b, c) FORMAT TabSeparated 3.0 -3.0 3
|
||||||
|
;
|
||||||
|
INSERT INTO test.decimal (a, b, c) FORMAT TabSeparated 0.3 -0.3 .3
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT * FROM test.decimal ORDER BY a FORMAT JSONEachRow;
|
||||||
|
SELECT * FROM test.decimal ORDER BY b DESC FORMAT CSV;
|
||||||
|
SELECT * FROM test.decimal ORDER BY c FORMAT TabSeparated;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS test.decimal;
|
Loading…
Reference in New Issue
Block a user