ClickHouse/tests/queries/0_stateless/02564_analyzer_cross_to_inner.reference
2023-08-24 22:32:40 +02:00

206 lines
9.6 KiB
Plaintext

5 6 5 6 5
3 4 3 4 5
3 4 3 4 7
3 4 3 4 9
5 6 5 6 5
5 6 5 6 7
5 6 5 6 9
-- { echoOn }
EXPLAIN QUERY TREE
SELECT * FROM t1, t2, (SELECT a as x from t3 where a + 1 = b ) as t3
WHERE t1.a = if(t2.b > 0, t2.a, 0) AND t2.a = t3.x AND 1;
QUERY id: 0
PROJECTION COLUMNS
t1.a UInt64
t1.b UInt64
t2.a UInt64
t2.b UInt64
x UInt64
PROJECTION
LIST id: 1, nodes: 5
COLUMN id: 2, column_name: a, result_type: UInt64, source_id: 3
COLUMN id: 4, column_name: b, result_type: UInt64, source_id: 3
COLUMN id: 5, column_name: a, result_type: UInt64, source_id: 6
COLUMN id: 7, column_name: b, result_type: UInt64, source_id: 6
COLUMN id: 8, column_name: x, result_type: UInt64, source_id: 9
JOIN TREE
JOIN id: 10, strictness: ALL, kind: INNER
LEFT TABLE EXPRESSION
JOIN id: 11, strictness: ALL, kind: INNER
LEFT TABLE EXPRESSION
TABLE id: 3, alias: __table1, table_name: default.t1
RIGHT TABLE EXPRESSION
TABLE id: 6, alias: __table2, table_name: default.t2
JOIN EXPRESSION
FUNCTION id: 12, function_name: equals, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 13, nodes: 2
COLUMN id: 14, column_name: a, result_type: UInt64, source_id: 3
FUNCTION id: 15, function_name: if, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 16, nodes: 3
FUNCTION id: 17, function_name: greater, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 18, nodes: 2
COLUMN id: 19, column_name: b, result_type: UInt64, source_id: 6
CONSTANT id: 20, constant_value: UInt64_0, constant_value_type: UInt8
COLUMN id: 21, column_name: a, result_type: UInt64, source_id: 6
CONSTANT id: 22, constant_value: UInt64_0, constant_value_type: UInt8
RIGHT TABLE EXPRESSION
QUERY id: 9, alias: __table3, is_subquery: 1
PROJECTION COLUMNS
x UInt64
PROJECTION
LIST id: 23, nodes: 1
COLUMN id: 24, column_name: a, result_type: UInt64, source_id: 25
JOIN TREE
TABLE id: 25, alias: __table4, table_name: default.t3
WHERE
FUNCTION id: 26, function_name: equals, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 27, nodes: 2
FUNCTION id: 28, function_name: plus, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 29, nodes: 2
COLUMN id: 24, column_name: a, result_type: UInt64, source_id: 25
CONSTANT id: 30, constant_value: UInt64_1, constant_value_type: UInt8
COLUMN id: 31, column_name: b, result_type: UInt64, source_id: 25
JOIN EXPRESSION
FUNCTION id: 32, function_name: equals, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 33, nodes: 2
COLUMN id: 21, column_name: a, result_type: UInt64, source_id: 6
COLUMN id: 34, column_name: x, result_type: UInt64, source_id: 9
WHERE
CONSTANT id: 35, constant_value: UInt64_1, constant_value_type: UInt8
EXPLAIN QUERY TREE
SELECT * FROM t1, t2, (SELECT a as x from t3 where a + 1 = b ) as t3
WHERE t1.a = if(t2.b > 0, t2.a, 0) AND t2.a = t3.x AND 1
SETTINGS cross_to_inner_join_rewrite = 0;
QUERY id: 0
PROJECTION COLUMNS
t1.a UInt64
t1.b UInt64
t2.a UInt64
t2.b UInt64
x UInt64
PROJECTION
LIST id: 1, nodes: 5
COLUMN id: 2, column_name: a, result_type: UInt64, source_id: 3
COLUMN id: 4, column_name: b, result_type: UInt64, source_id: 3
COLUMN id: 5, column_name: a, result_type: UInt64, source_id: 6
COLUMN id: 7, column_name: b, result_type: UInt64, source_id: 6
COLUMN id: 8, column_name: x, result_type: UInt64, source_id: 9
JOIN TREE
JOIN id: 10, kind: COMMA
LEFT TABLE EXPRESSION
JOIN id: 11, kind: COMMA
LEFT TABLE EXPRESSION
TABLE id: 3, alias: __table1, table_name: default.t1
RIGHT TABLE EXPRESSION
TABLE id: 6, alias: __table2, table_name: default.t2
RIGHT TABLE EXPRESSION
QUERY id: 9, alias: __table3, is_subquery: 1
PROJECTION COLUMNS
x UInt64
PROJECTION
LIST id: 12, nodes: 1
COLUMN id: 13, column_name: a, result_type: UInt64, source_id: 14
JOIN TREE
TABLE id: 14, alias: __table4, table_name: default.t3
WHERE
FUNCTION id: 15, function_name: equals, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 16, nodes: 2
FUNCTION id: 17, function_name: plus, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 18, nodes: 2
COLUMN id: 13, column_name: a, result_type: UInt64, source_id: 14
CONSTANT id: 19, constant_value: UInt64_1, constant_value_type: UInt8
COLUMN id: 20, column_name: b, result_type: UInt64, source_id: 14
WHERE
FUNCTION id: 21, function_name: and, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 22, nodes: 3
FUNCTION id: 23, function_name: equals, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 24, nodes: 2
COLUMN id: 25, column_name: a, result_type: UInt64, source_id: 3
FUNCTION id: 26, function_name: if, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 27, nodes: 3
FUNCTION id: 28, function_name: greater, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 29, nodes: 2
COLUMN id: 30, column_name: b, result_type: UInt64, source_id: 6
CONSTANT id: 31, constant_value: UInt64_0, constant_value_type: UInt8
COLUMN id: 32, column_name: a, result_type: UInt64, source_id: 6
CONSTANT id: 33, constant_value: UInt64_0, constant_value_type: UInt8
FUNCTION id: 34, function_name: equals, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 35, nodes: 2
COLUMN id: 32, column_name: a, result_type: UInt64, source_id: 6
COLUMN id: 36, column_name: x, result_type: UInt64, source_id: 9
CONSTANT id: 37, constant_value: UInt64_1, constant_value_type: UInt8
SETTINGS cross_to_inner_join_rewrite=0
EXPLAIN QUERY TREE
SELECT * FROM t1, t2, (SELECT a as x from t3 where a + 1 = b ) as t3
WHERE t1.a = if(t2.b > 0, t2.a, 0);
QUERY id: 0
PROJECTION COLUMNS
t1.a UInt64
t1.b UInt64
t2.a UInt64
t2.b UInt64
x UInt64
PROJECTION
LIST id: 1, nodes: 5
COLUMN id: 2, column_name: a, result_type: UInt64, source_id: 3
COLUMN id: 4, column_name: b, result_type: UInt64, source_id: 3
COLUMN id: 5, column_name: a, result_type: UInt64, source_id: 6
COLUMN id: 7, column_name: b, result_type: UInt64, source_id: 6
COLUMN id: 8, column_name: x, result_type: UInt64, source_id: 9
JOIN TREE
JOIN id: 10, kind: COMMA
LEFT TABLE EXPRESSION
JOIN id: 11, strictness: ALL, kind: INNER
LEFT TABLE EXPRESSION
TABLE id: 3, alias: __table1, table_name: default.t1
RIGHT TABLE EXPRESSION
TABLE id: 6, alias: __table2, table_name: default.t2
JOIN EXPRESSION
FUNCTION id: 12, function_name: equals, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 13, nodes: 2
COLUMN id: 14, column_name: a, result_type: UInt64, source_id: 3
FUNCTION id: 15, function_name: if, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 16, nodes: 3
FUNCTION id: 17, function_name: greater, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 18, nodes: 2
COLUMN id: 19, column_name: b, result_type: UInt64, source_id: 6
CONSTANT id: 20, constant_value: UInt64_0, constant_value_type: UInt8
COLUMN id: 21, column_name: a, result_type: UInt64, source_id: 6
CONSTANT id: 22, constant_value: UInt64_0, constant_value_type: UInt8
RIGHT TABLE EXPRESSION
QUERY id: 9, alias: __table3, is_subquery: 1
PROJECTION COLUMNS
x UInt64
PROJECTION
LIST id: 23, nodes: 1
COLUMN id: 24, column_name: a, result_type: UInt64, source_id: 25
JOIN TREE
TABLE id: 25, alias: __table4, table_name: default.t3
WHERE
FUNCTION id: 26, function_name: equals, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 27, nodes: 2
FUNCTION id: 28, function_name: plus, function_type: ordinary, result_type: UInt64
ARGUMENTS
LIST id: 29, nodes: 2
COLUMN id: 24, column_name: a, result_type: UInt64, source_id: 25
CONSTANT id: 30, constant_value: UInt64_1, constant_value_type: UInt8
COLUMN id: 31, column_name: b, result_type: UInt64, source_id: 25