From de30204c0070b8254f5266d52789c7aac2e21495 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Fri, 30 Dec 2016 04:30:47 +0300 Subject: [PATCH] Added test for pretty formats [#METR-2944]. --- .../00405_pretty_formats.reference | 213 ++++++++++++++++++ .../0_stateless/00405_pretty_formats.sql | 17 ++ 2 files changed, 230 insertions(+) create mode 100644 dbms/tests/queries/0_stateless/00405_pretty_formats.reference create mode 100644 dbms/tests/queries/0_stateless/00405_pretty_formats.sql diff --git a/dbms/tests/queries/0_stateless/00405_pretty_formats.reference b/dbms/tests/queries/0_stateless/00405_pretty_formats.reference new file mode 100644 index 00000000000..69081e6e56b --- /dev/null +++ b/dbms/tests/queries/0_stateless/00405_pretty_formats.reference @@ -0,0 +1,213 @@ +┏━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ +┃ hello ┃ world ┃ tuple  ┃ sometimes_nulls ┃ +┡━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ +│ 0 │ 0 │ (0,'0') │ \N │ +├───────┼───────┼─────────┼─────────────────┤ +│ 1 │ 1 │ (1,'1') │ 1 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 2 │ 2 │ (2,'2') │ 2 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 3 │ 3 │ (3,'3') │ \N │ +├───────┼───────┼─────────┼─────────────────┤ +│ 4 │ 4 │ (4,'4') │ 1 │ +└───────┴───────┴─────────┴─────────────────┘ +┏━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ +┃ hello ┃ world ┃ tuple  ┃ sometimes_nulls ┃ +┡━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ +│ 5 │ 5 │ (5,'5') │ 2 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 6 │ 6 │ (6,'6') │ \N │ +├───────┼───────┼─────────┼─────────────────┤ +│ 7 │ 7 │ (7,'7') │ 1 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 8 │ 8 │ (8,'8') │ 2 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 9 │ 9 │ (9,'9') │ \N │ +└───────┴───────┴─────────┴─────────────────┘ +┌─hello─┬─world─┬─tuple───┬─sometimes_nulls─┐ +│ 0 │ 0 │ (0,'0') │ \N │ +│ 1 │ 1 │ (1,'1') │ 1 │ +│ 2 │ 2 │ (2,'2') │ 2 │ +│ 3 │ 3 │ (3,'3') │ \N │ +│ 4 │ 4 │ (4,'4') │ 1 │ +└───────┴───────┴─────────┴─────────────────┘ +┌─hello─┬─world─┬─tuple───┬─sometimes_nulls─┐ +│ 5 │ 5 │ (5,'5') │ 2 │ +│ 6 │ 6 │ (6,'6') │ \N │ +│ 7 │ 7 │ (7,'7') │ 1 │ +│ 8 │ 8 │ (8,'8') │ 2 │ +│ 9 │ 9 │ (9,'9') │ \N │ +└───────┴───────┴─────────┴─────────────────┘ +hello world tuple sometimes_nulls + + 0 0 (0,'0') \N + 1 1 (1,'1') 1 + 2 2 (2,'2') 2 + 3 3 (3,'3') \N + 4 4 (4,'4') 1 +hello world tuple sometimes_nulls + + 5 5 (5,'5') 2 + 6 6 (6,'6') \N + 7 7 (7,'7') 1 + 8 8 (8,'8') 2 + 9 9 (9,'9') \N +┌─hello─┬─world─┬─tuple───┬─sometimes_nulls─┐ +│ 0 │ 0 │ (0,'0') │ \N │ +│ 1 │ 1 │ (1,'1') │ 1 │ +│ 2 │ 2 │ (2,'2') │ 2 │ +│ 3 │ 3 │ (3,'3') │ \N │ +│ 4 │ 4 │ (4,'4') │ 1 │ +│ 5 │ 5 │ (5,'5') │ 2 │ +│ 6 │ 6 │ (6,'6') │ \N │ +│ 7 │ 7 │ (7,'7') │ 1 │ +│ 8 │ 8 │ (8,'8') │ 2 │ +│ 9 │ 9 │ (9,'9') │ \N │ +└───────┴───────┴─────────┴─────────────────┘ +┏━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ +┃ hello ┃ world ┃ tuple ┃ sometimes_nulls ┃ +┡━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ +│ 0 │ 0 │ (0,'0') │ \N │ +├───────┼───────┼─────────┼─────────────────┤ +│ 1 │ 1 │ (1,'1') │ 1 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 2 │ 2 │ (2,'2') │ 2 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 3 │ 3 │ (3,'3') │ \N │ +├───────┼───────┼─────────┼─────────────────┤ +│ 4 │ 4 │ (4,'4') │ 1 │ +└───────┴───────┴─────────┴─────────────────┘ +┏━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ +┃ hello ┃ world ┃ tuple ┃ sometimes_nulls ┃ +┡━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ +│ 5 │ 5 │ (5,'5') │ 2 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 6 │ 6 │ (6,'6') │ \N │ +├───────┼───────┼─────────┼─────────────────┤ +│ 7 │ 7 │ (7,'7') │ 1 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 8 │ 8 │ (8,'8') │ 2 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 9 │ 9 │ (9,'9') │ \N │ +└───────┴───────┴─────────┴─────────────────┘ +┌─hello─┬─world─┬─tuple───┬─sometimes_nulls─┐ +│ 0 │ 0 │ (0,'0') │ \N │ +│ 1 │ 1 │ (1,'1') │ 1 │ +│ 2 │ 2 │ (2,'2') │ 2 │ +│ 3 │ 3 │ (3,'3') │ \N │ +│ 4 │ 4 │ (4,'4') │ 1 │ +└───────┴───────┴─────────┴─────────────────┘ +┌─hello─┬─world─┬─tuple───┬─sometimes_nulls─┐ +│ 5 │ 5 │ (5,'5') │ 2 │ +│ 6 │ 6 │ (6,'6') │ \N │ +│ 7 │ 7 │ (7,'7') │ 1 │ +│ 8 │ 8 │ (8,'8') │ 2 │ +│ 9 │ 9 │ (9,'9') │ \N │ +└───────┴───────┴─────────┴─────────────────┘ +hello world tuple sometimes_nulls + + 0 0 (0,'0') \N + 1 1 (1,'1') 1 + 2 2 (2,'2') 2 + 3 3 (3,'3') \N + 4 4 (4,'4') 1 +hello world tuple sometimes_nulls + + 5 5 (5,'5') 2 + 6 6 (6,'6') \N + 7 7 (7,'7') 1 + 8 8 (8,'8') 2 + 9 9 (9,'9') \N +┏━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ +┃ hello ┃ world ┃ tuple  ┃ sometimes_nulls ┃ +┡━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ +│ 0 │ 0 │ (0,'0') │ \N │ +├───────┼───────┼─────────┼─────────────────┤ +│ 1 │ 1 │ (1,'1') │ 1 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 2 │ 2 │ (2,'2') │ 2 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 3 │ 3 │ (3,'3') │ \N │ +├───────┼───────┼─────────┼─────────────────┤ +│ 4 │ 4 │ (4,'4') │ 1 │ +└───────┴───────┴─────────┴─────────────────┘ +┏━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ +┃ hello ┃ world ┃ tuple  ┃ sometimes_nulls ┃ +┡━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ +│ 5 │ 5 │ (5,'5') │ 2 │ +└───────┴───────┴─────────┴─────────────────┘ + Showed first 6. +┌─hello─┬─world─┬─tuple───┬─sometimes_nulls─┐ +│ 0 │ 0 │ (0,'0') │ \N │ +│ 1 │ 1 │ (1,'1') │ 1 │ +│ 2 │ 2 │ (2,'2') │ 2 │ +│ 3 │ 3 │ (3,'3') │ \N │ +│ 4 │ 4 │ (4,'4') │ 1 │ +└───────┴───────┴─────────┴─────────────────┘ +┌─hello─┬─world─┬─tuple───┬─sometimes_nulls─┐ +│ 5 │ 5 │ (5,'5') │ 2 │ +└───────┴───────┴─────────┴─────────────────┘ + Showed first 6. +hello world tuple sometimes_nulls + + 0 0 (0,'0') \N + 1 1 (1,'1') 1 + 2 2 (2,'2') 2 + 3 3 (3,'3') \N + 4 4 (4,'4') 1 +hello world tuple sometimes_nulls + + 5 5 (5,'5') 2 + +Showed first 6. +┌─hello─┬─world─┬─tuple───┬─sometimes_nulls─┐ +│ 0 │ 0 │ (0,'0') │ \N │ +│ 1 │ 1 │ (1,'1') │ 1 │ +│ 2 │ 2 │ (2,'2') │ 2 │ +│ 3 │ 3 │ (3,'3') │ \N │ +│ 4 │ 4 │ (4,'4') │ 1 │ +│ 5 │ 5 │ (5,'5') │ 2 │ +└───────┴───────┴─────────┴─────────────────┘ + Showed first 6. +┏━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ +┃ hello ┃ world ┃ tuple ┃ sometimes_nulls ┃ +┡━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ +│ 0 │ 0 │ (0,'0') │ \N │ +├───────┼───────┼─────────┼─────────────────┤ +│ 1 │ 1 │ (1,'1') │ 1 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 2 │ 2 │ (2,'2') │ 2 │ +├───────┼───────┼─────────┼─────────────────┤ +│ 3 │ 3 │ (3,'3') │ \N │ +├───────┼───────┼─────────┼─────────────────┤ +│ 4 │ 4 │ (4,'4') │ 1 │ +└───────┴───────┴─────────┴─────────────────┘ +┏━━━━━━━┳━━━━━━━┳━━━━━━━━━┳━━━━━━━━━━━━━━━━━┓ +┃ hello ┃ world ┃ tuple ┃ sometimes_nulls ┃ +┡━━━━━━━╇━━━━━━━╇━━━━━━━━━╇━━━━━━━━━━━━━━━━━┩ +│ 5 │ 5 │ (5,'5') │ 2 │ +└───────┴───────┴─────────┴─────────────────┘ + Showed first 6. +┌─hello─┬─world─┬─tuple───┬─sometimes_nulls─┐ +│ 0 │ 0 │ (0,'0') │ \N │ +│ 1 │ 1 │ (1,'1') │ 1 │ +│ 2 │ 2 │ (2,'2') │ 2 │ +│ 3 │ 3 │ (3,'3') │ \N │ +│ 4 │ 4 │ (4,'4') │ 1 │ +└───────┴───────┴─────────┴─────────────────┘ +┌─hello─┬─world─┬─tuple───┬─sometimes_nulls─┐ +│ 5 │ 5 │ (5,'5') │ 2 │ +└───────┴───────┴─────────┴─────────────────┘ + Showed first 6. +hello world tuple sometimes_nulls + + 0 0 (0,'0') \N + 1 1 (1,'1') 1 + 2 2 (2,'2') 2 + 3 3 (3,'3') \N + 4 4 (4,'4') 1 +hello world tuple sometimes_nulls + + 5 5 (5,'5') 2 + +Showed first 6. diff --git a/dbms/tests/queries/0_stateless/00405_pretty_formats.sql b/dbms/tests/queries/0_stateless/00405_pretty_formats.sql new file mode 100644 index 00000000000..dd733f9ecde --- /dev/null +++ b/dbms/tests/queries/0_stateless/00405_pretty_formats.sql @@ -0,0 +1,17 @@ +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT Pretty; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettyCompact; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettySpace; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettyCompactMonoBlock; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettyNoEscapes; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettyCompactNoEscapes; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettySpaceNoEscapes; + +SET output_format_pretty_max_rows = 6; + +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT Pretty; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettyCompact; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettySpace; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettyCompactMonoBlock; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettyNoEscapes; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettyCompactNoEscapes; +SELECT number AS hello, toString(number) AS world, (hello, world) AS tuple, nullIf(hello % 3, 0) AS sometimes_nulls FROM system.numbers LIMIT 10 SETTINGS max_block_size = 5 FORMAT PrettySpaceNoEscapes;