Add one more test

This commit is contained in:
Dmitry Novik 2024-12-13 16:36:55 +01:00
parent 610bb8e210
commit 537f539eee
2 changed files with 66 additions and 0 deletions

View File

@ -169,3 +169,63 @@ FROM default.x AS __table1
WHERE (__table1.A AND __table1.B) OR (__table1.A AND __table1.B AND __table1.C) OR (__table1.D AND __table1.E)
SETTINGS optimize_extract_common_expressions = 0
873
QUERY id: 0
PROJECTION COLUMNS
count() UInt64
PROJECTION
LIST id: 1, nodes: 1
FUNCTION id: 2, function_name: count, function_type: aggregate, result_type: UInt64
JOIN TREE
TABLE id: 3, alias: __table1, table_name: default.x
WHERE
FUNCTION id: 4, function_name: and, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 5, nodes: 2
COLUMN id: 6, column_name: B, result_type: UInt8, source_id: 3
FUNCTION id: 7, function_name: or, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 8, nodes: 2
COLUMN id: 9, column_name: A, result_type: UInt8, source_id: 3
COLUMN id: 10, column_name: C, result_type: UInt8, source_id: 3
SETTINGS optimize_extract_common_expressions=1
SELECT count() AS `count()`
FROM default.x AS __table1
WHERE __table1.B AND (__table1.A OR __table1.C)
SETTINGS optimize_extract_common_expressions = 1
752
QUERY id: 0
PROJECTION COLUMNS
count() UInt64
PROJECTION
LIST id: 1, nodes: 1
FUNCTION id: 2, function_name: count, function_type: aggregate, result_type: UInt64
JOIN TREE
TABLE id: 3, alias: __table1, table_name: default.x
WHERE
FUNCTION id: 4, function_name: or, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 5, nodes: 3
FUNCTION id: 6, function_name: and, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 7, nodes: 2
COLUMN id: 8, column_name: A, result_type: UInt8, source_id: 3
COLUMN id: 9, column_name: B, result_type: UInt8, source_id: 3
FUNCTION id: 10, function_name: and, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 11, nodes: 3
COLUMN id: 8, column_name: A, result_type: UInt8, source_id: 3
COLUMN id: 9, column_name: B, result_type: UInt8, source_id: 3
COLUMN id: 12, column_name: C, result_type: UInt8, source_id: 3
FUNCTION id: 13, function_name: and, function_type: ordinary, result_type: UInt8
ARGUMENTS
LIST id: 14, nodes: 2
COLUMN id: 9, column_name: B, result_type: UInt8, source_id: 3
COLUMN id: 12, column_name: C, result_type: UInt8, source_id: 3
SETTINGS optimize_extract_common_expressions=0
SELECT count() AS `count()`
FROM default.x AS __table1
WHERE (__table1.A AND __table1.B) OR (__table1.A AND __table1.B AND __table1.C) OR (__table1.B AND __table1.C)
SETTINGS optimize_extract_common_expressions = 0
752

View File

@ -31,3 +31,9 @@ SELECT count() FROM x WHERE (A and B) or (A and B and C) or (D and E) SETTINGS o
EXPLAIN QUERY TREE dump_ast = 1 SELECT count() FROM x WHERE (A and B) or (A and B and C) or (D and E) SETTINGS optimize_extract_common_expressions = 0;
SELECT count() FROM x WHERE (A and B) or (A and B and C) or (D and E) SETTINGS optimize_extract_common_expressions = 0;
EXPLAIN QUERY TREE dump_ast = 1 SELECT count() FROM x WHERE (A and B) or (A and B and C) or (B and C) SETTINGS optimize_extract_common_expressions = 1;
SELECT count() FROM x WHERE (A and B) or (A and B and C) or (B and C) SETTINGS optimize_extract_common_expressions = 1;
EXPLAIN QUERY TREE dump_ast = 1 SELECT count() FROM x WHERE (A and B) or (A and B and C) or (B and C) SETTINGS optimize_extract_common_expressions = 0;
SELECT count() FROM x WHERE (A and B) or (A and B and C) or (B and C) SETTINGS optimize_extract_common_expressions = 0;