Added test for pretty formats [#METR-2944].

This commit is contained in:
Alexey Milovidov 2016-12-30 04:30:47 +03:00
parent 025bfd414f
commit de30204c00
2 changed files with 230 additions and 0 deletions

View File

@ -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.

View File

@ -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;