-
Notifications
You must be signed in to change notification settings - Fork 608
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(analysis): simplify and improve
pushdown_selection_filters()
- Loading branch information
Showing
13 changed files
with
120 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 7 additions & 10 deletions
17
ibis/backends/impala/tests/snapshots/test_sql/test_multiple_filters/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
SELECT t0.* | ||
FROM ( | ||
SELECT t1.* | ||
FROM `t0` t1 | ||
WHERE t1.`a` < 100 | ||
) t0 | ||
WHERE t0.`a` = ( | ||
SELECT max(t1.`a`) AS `Max(a)` | ||
FROM `t0` t1 | ||
WHERE t1.`a` < 100 | ||
) | ||
FROM `t0` t0 | ||
WHERE (t0.`a` < 100) AND | ||
(t0.`a` = ( | ||
SELECT max(t0.`a`) AS `Max(a)` | ||
FROM `t0` t0 | ||
WHERE t0.`a` < 100 | ||
)) |
16 changes: 6 additions & 10 deletions
16
ibis/backends/impala/tests/snapshots/test_sql/test_multiple_filters2/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
WITH t0 AS ( | ||
SELECT t1.* | ||
FROM `t0` t1 | ||
WHERE t1.`a` < 100 | ||
) | ||
SELECT t0.* | ||
FROM t0 | ||
WHERE (t0.`a` = ( | ||
SELECT max(t1.`a`) AS `Max(a)` | ||
FROM `t0` t1 | ||
WHERE t1.`a` < 100 | ||
FROM `t0` t0 | ||
WHERE (t0.`a` < 100) AND | ||
(t0.`a` = ( | ||
SELECT max(t0.`a`) AS `Max(a)` | ||
FROM `t0` t0 | ||
WHERE t0.`a` < 100 | ||
)) AND | ||
(t0.`b` = 'a') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 6 additions & 10 deletions
16
ibis/tests/sql/snapshots/test_compiler/test_agg_and_non_agg_filter/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
WITH t0 AS ( | ||
SELECT t1.* | ||
FROM my_table t1 | ||
WHERE t1.`a` < 100 | ||
) | ||
SELECT t0.* | ||
FROM t0 | ||
WHERE (t0.`a` = ( | ||
SELECT max(t1.`a`) AS `Max(a)` | ||
FROM my_table t1 | ||
WHERE t1.`a` < 100 | ||
FROM my_table t0 | ||
WHERE (t0.`a` < 100) AND | ||
(t0.`a` = ( | ||
SELECT max(t0.`a`) AS `Max(a)` | ||
FROM my_table t0 | ||
WHERE t0.`a` < 100 | ||
)) AND | ||
(t0.`b` = 'a') |
22 changes: 9 additions & 13 deletions
22
ibis/tests/sql/snapshots/test_compiler/test_agg_filter/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
WITH t0 AS ( | ||
SELECT t2.*, t2.`b` * 2 AS `b2` | ||
FROM my_table t2 | ||
), | ||
t1 AS ( | ||
SELECT t0.`a`, t0.`b2` | ||
FROM t0 | ||
WHERE t0.`a` < 100 | ||
SELECT t1.*, t1.`b` * 2 AS `b2` | ||
FROM my_table t1 | ||
) | ||
SELECT t1.* | ||
FROM t1 | ||
WHERE t1.`a` = ( | ||
SELECT max(t1.`a`) AS `Max(a)` | ||
FROM t1 | ||
) | ||
SELECT t0.`a`, t0.`b2` | ||
FROM t0 | ||
WHERE (t0.`a` < 100) AND | ||
(t0.`a` = ( | ||
SELECT max(t0.`a`) AS `Max(a)` | ||
FROM t0 | ||
)) |
22 changes: 9 additions & 13 deletions
22
ibis/tests/sql/snapshots/test_compiler/test_agg_filter_with_alias/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
WITH t0 AS ( | ||
SELECT t2.*, t2.`b` * 2 AS `b2` | ||
FROM my_table t2 | ||
), | ||
t1 AS ( | ||
SELECT t0.`a`, t0.`b2` | ||
FROM t0 | ||
WHERE t0.`a` < 100 | ||
SELECT t1.*, t1.`b` * 2 AS `b2` | ||
FROM my_table t1 | ||
) | ||
SELECT t1.* | ||
FROM t1 | ||
WHERE t1.`a` = ( | ||
SELECT max(t1.`a`) AS `Max(a)` | ||
FROM t1 | ||
) | ||
SELECT t0.`a`, t0.`b2` | ||
FROM t0 | ||
WHERE (t0.`a` < 100) AND | ||
(t0.`a` = ( | ||
SELECT max(t0.`a`) AS `Max(a)` | ||
FROM t0 | ||
)) |
17 changes: 7 additions & 10 deletions
17
ibis/tests/sql/snapshots/test_compiler/test_simple_agg_filter/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,8 @@ | ||
SELECT t0.* | ||
FROM ( | ||
SELECT t1.* | ||
FROM my_table t1 | ||
WHERE t1.`a` < 100 | ||
) t0 | ||
WHERE t0.`a` = ( | ||
SELECT max(t1.`a`) AS `Max(a)` | ||
FROM my_table t1 | ||
WHERE t1.`a` < 100 | ||
) | ||
FROM my_table t0 | ||
WHERE (t0.`a` < 100) AND | ||
(t0.`a` = ( | ||
SELECT max(t0.`a`) AS `Max(a)` | ||
FROM my_table t0 | ||
WHERE t0.`a` < 100 | ||
)) |
14 changes: 4 additions & 10 deletions
14
ibis/tests/sql/snapshots/test_select_sql/test_filter_predicates/out.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,5 @@ | ||
SELECT t0.* | ||
FROM ( | ||
SELECT * | ||
FROM ( | ||
SELECT t2.* | ||
FROM t t2 | ||
WHERE (lower(t2.`color`) LIKE '%de%') AND | ||
(locate('de', lower(t2.`color`)) - 1 >= 0) | ||
) t1 | ||
) t0 | ||
WHERE regexp_like(lower(t0.`color`), '.*ge.*') | ||
FROM t t0 | ||
WHERE (lower(t0.`color`) LIKE '%de%') AND | ||
(locate('de', lower(t0.`color`)) - 1 >= 0) AND | ||
(regexp_like(lower(t0.`color`), '.*ge.*')) |
Oops, something went wrong.