ClickHouse/tests/queries/0_stateless/02534_analyzer_grouping_function.reference
2023-08-23 16:06:14 +00:00

142 lines
6.3 KiB
Plaintext

-- { echoOn }
EXPLAIN QUERY TREE SELECT grouping(id), grouping(value) FROM test_table GROUP BY id, value;
QUERY id: 0
PROJECTION COLUMNS
grouping(id) UInt64
grouping(value) UInt64
PROJECTION
LIST id: 1, nodes: 2
FUNCTION id: 2, function_name: groupingOrdinary, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 3, nodes: 1
COLUMN id: 4, column_name: id, result_type: UInt64, source_id: 5
FUNCTION id: 6, function_name: groupingOrdinary, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 7, nodes: 1
COLUMN id: 8, column_name: value, result_type: String, source_id: 5
JOIN TREE
TABLE id: 5, alias: __table1, table_name: default.test_table
GROUP BY
LIST id: 9, nodes: 2
COLUMN id: 4, column_name: id, result_type: UInt64, source_id: 5
COLUMN id: 8, column_name: value, result_type: String, source_id: 5
SELECT grouping(id) AS grouping_id, grouping(value) AS grouping_value, id, value FROM test_table
GROUP BY id, value ORDER BY grouping_id, grouping_value;
0 0 0 Value
EXPLAIN QUERY TREE SELECT grouping(id), grouping(value) FROM test_table GROUP BY ROLLUP (id, value);
QUERY id: 0, group_by_type: rollup
PROJECTION COLUMNS
grouping(id) UInt64
grouping(value) UInt64
PROJECTION
LIST id: 1, nodes: 2
FUNCTION id: 2, function_name: groupingForRollup, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 3, nodes: 2
COLUMN id: 4, column_name: __grouping_set, result_type: UInt64
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
FUNCTION id: 7, function_name: groupingForRollup, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 8, nodes: 2
COLUMN id: 9, column_name: __grouping_set, result_type: UInt64
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
JOIN TREE
TABLE id: 6, alias: __table1, table_name: default.test_table
GROUP BY
LIST id: 11, nodes: 2
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
SELECT grouping(id) AS grouping_id, grouping(value) AS grouping_value, id, value FROM test_table
GROUP BY ROLLUP (id, value) ORDER BY grouping_id, grouping_value;
0 0 0 Value
0 1 0
1 1 0
EXPLAIN QUERY TREE SELECT grouping(id), grouping(value) FROM test_table GROUP BY CUBE (id, value);
QUERY id: 0, group_by_type: cube
PROJECTION COLUMNS
grouping(id) UInt64
grouping(value) UInt64
PROJECTION
LIST id: 1, nodes: 2
FUNCTION id: 2, function_name: groupingForCube, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 3, nodes: 2
COLUMN id: 4, column_name: __grouping_set, result_type: UInt64
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
FUNCTION id: 7, function_name: groupingForCube, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 8, nodes: 2
COLUMN id: 9, column_name: __grouping_set, result_type: UInt64
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
JOIN TREE
TABLE id: 6, alias: __table1, table_name: default.test_table
GROUP BY
LIST id: 11, nodes: 2
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
SELECT grouping(id) AS grouping_id, grouping(value) AS grouping_value, id, value FROM test_table
GROUP BY CUBE (id, value) ORDER BY grouping_id, grouping_value;
0 0 0 Value
0 1 0
1 0 0 Value
1 1 0
EXPLAIN QUERY TREE SELECT grouping(id), grouping(value) FROM test_table GROUP BY GROUPING SETS (id, value);
QUERY id: 0, group_by_type: grouping_sets
PROJECTION COLUMNS
grouping(id) UInt64
grouping(value) UInt64
PROJECTION
LIST id: 1, nodes: 2
FUNCTION id: 2, function_name: groupingForGroupingSets, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 3, nodes: 2
COLUMN id: 4, column_name: __grouping_set, result_type: UInt64
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
FUNCTION id: 7, function_name: groupingForGroupingSets, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 8, nodes: 2
COLUMN id: 9, column_name: __grouping_set, result_type: UInt64
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
JOIN TREE
TABLE id: 6, alias: __table1, table_name: default.test_table
GROUP BY
LIST id: 11, nodes: 2
LIST id: 12, nodes: 1
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
LIST id: 13, nodes: 1
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
SELECT grouping(id) AS grouping_id, grouping(value) AS grouping_value, id, value FROM test_table
GROUP BY GROUPING SETS (id, value) ORDER BY grouping_id, grouping_value;
0 1 0
1 0 0 Value
EXPLAIN QUERY TREE SELECT grouping(id), grouping(value) FROM test_table GROUP BY GROUPING SETS ((id), (value));
QUERY id: 0, group_by_type: grouping_sets
PROJECTION COLUMNS
grouping(id) UInt64
grouping(value) UInt64
PROJECTION
LIST id: 1, nodes: 2
FUNCTION id: 2, function_name: groupingForGroupingSets, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 3, nodes: 2
COLUMN id: 4, column_name: __grouping_set, result_type: UInt64
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
FUNCTION id: 7, function_name: groupingForGroupingSets, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 8, nodes: 2
COLUMN id: 9, column_name: __grouping_set, result_type: UInt64
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
JOIN TREE
TABLE id: 6, alias: __table1, table_name: default.test_table
GROUP BY
LIST id: 11, nodes: 2
LIST id: 12, nodes: 1
COLUMN id: 5, column_name: id, result_type: UInt64, source_id: 6
LIST id: 13, nodes: 1
COLUMN id: 10, column_name: value, result_type: String, source_id: 6
SELECT grouping(id) AS grouping_id, grouping(value) AS grouping_value, id, value FROM test_table
GROUP BY GROUPING SETS ((id), (value)) ORDER BY grouping_id, grouping_value;
0 1 0
1 0 0 Value