mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-25 17:12:03 +00:00
118bea2be6
* Enable predicate push-down optimization by default. * Forbid push-downs for some JOIN cases. * Fix existing tests * Forbid optimization if a select query has ARRAY JOIN on any side.
56 lines
7.6 KiB
Plaintext
56 lines
7.6 KiB
Plaintext
SELECT a\nFROM t1 \nCROSS JOIN \n(\n SELECT *\n FROM t2 \n) AS t2
|
|
SELECT a\nFROM t1 \nALL INNER JOIN \n(\n SELECT *\n FROM t2 \n) AS t2 ON a = t2.a\nWHERE a = t2.a
|
|
SELECT a\nFROM t1 \nALL INNER JOIN \n(\n SELECT *\n FROM t2 \n) AS t2 ON b = t2.b\nWHERE b = t2.b
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n a AS `--t1.a`, \n b, \n t2.a AS `--t2.a`, \n t2.b\n FROM t1 \n ALL INNER JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 ON `--t1.a` = `--t2.a`\n WHERE `--t1.a` = `--t2.a`\n) \nALL INNER JOIN \n(\n SELECT *\n FROM t3 \n) AS t3 ON `--t1.a` = a\nWHERE (`--t1.a` = `--t2.a`) AND (`--t1.a` = a)
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n a AS `--t1.a`, \n b AS `--t1.b`, \n t2.a, \n t2.b AS `--t2.b`\n FROM t1 \n ALL INNER JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 ON `--t1.b` = `--t2.b`\n WHERE `--t1.b` = `--t2.b`\n) \nALL INNER JOIN \n(\n SELECT *\n FROM t3 \n) AS t3 ON `--t1.b` = b\nWHERE (`--t1.b` = `--t2.b`) AND (`--t1.b` = b)
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n `--t1.a`, \n b, \n `--t2.a`, \n `t2.b`, \n a AS `--t3.a`, \n t3.b\n FROM \n (\n SELECT \n a AS `--t1.a`, \n b, \n t2.a AS `--t2.a`, \n t2.b\n FROM t1 \n ALL INNER JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 ON `--t1.a` = `--t2.a`\n WHERE `--t1.a` = `--t2.a`\n ) \n ALL INNER JOIN \n (\n SELECT *\n FROM t3 \n ) AS t3 ON `--t1.a` = `--t3.a`\n WHERE (`--t1.a` = `--t3.a`) AND (`--t1.a` = `--t2.a`)\n) \nALL INNER JOIN \n(\n SELECT *\n FROM t4 \n) AS t4 ON `--t1.a` = a\nWHERE (`--t1.a` = `--t2.a`) AND (`--t1.a` = `--t3.a`) AND (`--t1.a` = a)
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n `--t1.a`, \n `--t1.b`, \n `t2.a`, \n `--t2.b`, \n a, \n b AS `--t3.b`\n FROM \n (\n SELECT \n a AS `--t1.a`, \n b AS `--t1.b`, \n t2.a, \n t2.b AS `--t2.b`\n FROM t1 \n ALL INNER JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 ON `--t1.b` = `--t2.b`\n WHERE `--t1.b` = `--t2.b`\n ) \n ALL INNER JOIN \n (\n SELECT *\n FROM t3 \n ) AS t3 ON `--t1.b` = `--t3.b`\n WHERE (`--t1.b` = `--t3.b`) AND (`--t1.b` = `--t2.b`)\n) \nALL INNER JOIN \n(\n SELECT *\n FROM t4 \n) AS t4 ON `--t1.b` = b\nWHERE (`--t1.b` = `--t2.b`) AND (`--t1.b` = `--t3.b`) AND (`--t1.b` = b)
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n `--t1.a`, \n b, \n `--t2.a`, \n `t2.b`, \n a AS `--t3.a`, \n t3.b\n FROM \n (\n SELECT \n a AS `--t1.a`, \n b, \n t2.a AS `--t2.a`, \n t2.b\n FROM t1 \n ALL INNER JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 ON `--t2.a` = `--t1.a`\n WHERE `--t2.a` = `--t1.a`\n ) \n ALL INNER JOIN \n (\n SELECT *\n FROM t3 \n ) AS t3 ON `--t2.a` = `--t3.a`\n WHERE (`--t2.a` = `--t3.a`) AND (`--t2.a` = `--t1.a`)\n) \nALL INNER JOIN \n(\n SELECT *\n FROM t4 \n) AS t4 ON `--t2.a` = a\nWHERE (`--t2.a` = `--t1.a`) AND (`--t2.a` = `--t3.a`) AND (`--t2.a` = a)
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n `--t1.a`, \n b, \n `--t2.a`, \n `t2.b`, \n a AS `--t3.a`, \n t3.b\n FROM \n (\n SELECT \n a AS `--t1.a`, \n b, \n t2.a AS `--t2.a`, \n t2.b\n FROM t1 \n CROSS JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 \n ) \n ALL INNER JOIN \n (\n SELECT *\n FROM t3 \n ) AS t3 ON (`--t3.a` = `--t1.a`) AND (`--t3.a` = `--t2.a`)\n WHERE (`--t3.a` = `--t2.a`) AND (`--t3.a` = `--t1.a`)\n) \nALL INNER JOIN \n(\n SELECT *\n FROM t4 \n) AS t4 ON `--t3.a` = a\nWHERE (`--t3.a` = `--t1.a`) AND (`--t3.a` = `--t2.a`) AND (`--t3.a` = a)
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n `--t1.a`, \n b, \n `--t2.a`, \n `t2.b`, \n a AS `--t3.a`, \n t3.b\n FROM \n (\n SELECT \n a AS `--t1.a`, \n b, \n t2.a AS `--t2.a`, \n t2.b\n FROM t1 \n CROSS JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 \n ) \n CROSS JOIN \n (\n SELECT *\n FROM t3 \n ) AS t3 \n) \nALL INNER JOIN \n(\n SELECT *\n FROM t4 \n) AS t4 ON (a = `--t1.a`) AND (a = `--t2.a`) AND (a = `--t3.a`)\nWHERE (a = `--t1.a`) AND (a = `--t2.a`) AND (a = `--t3.a`)
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n `--t1.a`, \n b, \n `--t2.a`, \n `t2.b`, \n a AS `--t3.a`, \n t3.b\n FROM \n (\n SELECT \n a AS `--t1.a`, \n b, \n t2.a AS `--t2.a`, \n t2.b\n FROM t1 \n ALL INNER JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 ON `--t1.a` = `--t2.a`\n WHERE `--t1.a` = `--t2.a`\n ) \n ALL INNER JOIN \n (\n SELECT *\n FROM t3 \n ) AS t3 ON `--t2.a` = `--t3.a`\n WHERE (`--t2.a` = `--t3.a`) AND (`--t1.a` = `--t2.a`)\n) \nALL INNER JOIN \n(\n SELECT *\n FROM t4 \n) AS t4 ON `--t3.a` = a\nWHERE (`--t1.a` = `--t2.a`) AND (`--t2.a` = `--t3.a`) AND (`--t3.a` = a)
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n `--t1.a`, \n b, \n `t2.a`, \n `t2.b`, \n a, \n t3.b\n FROM \n (\n SELECT \n a AS `--t1.a`, \n b, \n t2.a, \n t2.b\n FROM t1 \n CROSS JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 \n ) \n CROSS JOIN \n (\n SELECT *\n FROM t3 \n ) AS t3 \n) \nCROSS JOIN \n(\n SELECT *\n FROM t4 \n) AS t4
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n `--t1.a`, \n b, \n `t2.a`, \n `t2.b`, \n a, \n t3.b\n FROM \n (\n SELECT \n a AS `--t1.a`, \n b, \n t2.a, \n t2.b\n FROM t1 \n CROSS JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 \n ) \n CROSS JOIN \n (\n SELECT *\n FROM t3 \n ) AS t3 \n) \nCROSS JOIN \n(\n SELECT *\n FROM t4 \n) AS t4
|
|
SELECT `--t1.a` AS `t1.a`\nFROM \n(\n SELECT \n a AS `--t1.a`, \n b, \n t2.a AS `--t2.a`, \n t2.b\n FROM t1 \n ALL INNER JOIN \n (\n SELECT *\n FROM t2 \n ) AS t2 ON `--t1.a` = `--t2.a`\n) \nCROSS JOIN \n(\n SELECT *\n FROM t3 \n) AS t3
|
|
SELECT * FROM t1, t2
|
|
1 1 1 1
|
|
1 1 1 \N
|
|
2 2 1 1
|
|
2 2 1 \N
|
|
3 3 1 1
|
|
3 3 1 \N
|
|
4 4 1 1
|
|
4 4 1 \N
|
|
SELECT * FROM t1, t2 WHERE t1.a = t2.a
|
|
1 1 1 1
|
|
1 1 1 \N
|
|
SELECT t1.a, t2.a FROM t1, t2 WHERE t1.b = t2.b
|
|
1 1
|
|
SELECT t1.a, t2.b, t3.b FROM t1, t2, t3 WHERE t1.a = t2.a AND t1.a = t3.a
|
|
1 1 1
|
|
1 1 \N
|
|
1 \N 1
|
|
1 \N \N
|
|
SELECT t1.a, t2.b, t3.b FROM t1, t2, t3 WHERE t1.b = t2.b AND t1.b = t3.b
|
|
1 1 1
|
|
SELECT t1.a, t2.b, t3.b, t4.b FROM t1, t2, t3, t4 WHERE t1.a = t2.a AND t1.a = t3.a AND t1.a = t4.a
|
|
1 1 1 1
|
|
1 1 1 \N
|
|
1 1 \N 1
|
|
1 1 \N \N
|
|
1 \N 1 1
|
|
1 \N 1 \N
|
|
1 \N \N 1
|
|
1 \N \N \N
|
|
SELECT t1.a, t2.b, t3.b, t4.b FROM t1, t2, t3, t4 WHERE t1.b = t2.b AND t1.b = t3.b AND t1.b = t4.b
|
|
1 1 1 1
|
|
SELECT t1.a, t2.b, t3.b, t4.b FROM t1, t2, t3, t4 WHERE t1.a = t2.a AND t2.a = t3.a AND t3.a = t4.a
|
|
1 1 1 1
|
|
1 1 1 \N
|
|
1 1 \N 1
|
|
1 1 \N \N
|
|
1 \N 1 1
|
|
1 \N 1 \N
|
|
1 \N \N 1
|
|
1 \N \N \N
|