forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
filter out equal to self, generate all possible predicates
Why the plans of TPCDSV1_4_PlanStabilitySuite changed? For q5, the condition of EliminateOuterJoin only fulfilled after InferFiltersFromConstraints, so the added InferFiltersFromConstraints pushes more predicates down For q8, the added predicates of filter apache#19 is inferred by InferFiltersFromConstraints according to EqualNullSafe; about the added predicates of scan apache#13 and filter apache#15, after the predicate isnotnull(substr(ca_zip#9, 1, 5)) is pushed to filter apache#15 by current rules, then the laster InferFiltersFromConstraints pushes isnotnull(ca_zip#9) to filter apache#15 and scan apache#13. For q14a, the added predicates of filter apache#18 is inferred by InferFiltersFromConstraints according to EqualNullSafe. For q14b, it's same with q14a. For q85, PushExtraPredicateThroughJoin pushes predicates from join apache#21, then the added InferFiltersFromConstraints inferred the predicates from join apache#27 For q93, it's same as q5 Why the plans of TPCDSV2_7_PlanStabilityWithStatsSuite, TPCDSV1_4_PlanStabilityWithStatsSuite and TPCDSV2_7_PlanStabilitySuite changed? For TPCDSV2_7_PlanStabilityWithStatsSuite and TPCDSV2_7_PlanStabilitySuite, it's same as TPCDSV1_4_PlanStabilitySuite. For TPCDSV1_4_PlanStabilityWithStatsSuite, most plans are changed with same reason as TPCDSV1_4_PlanStabilitySuite, except q85, whose plan is changed further by rule CostBasedJoinReorder is triggered.
- Loading branch information
1 parent
d648816
commit d5dda74
Showing
41 changed files
with
1,078 additions
and
928 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
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
91 changes: 91 additions & 0 deletions
91
sql/core/src/test/resources/sql-tests/analyzer-results/infer-filters.sql.out
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 |
---|---|---|
@@ -0,0 +1,91 @@ | ||
-- Automatically generated by SQLQueryTestSuite | ||
-- !query | ||
CREATE TABLE i1_tbl ( | ||
t1a integer, | ||
t1b integer, | ||
t1c integer, | ||
t1d integer, | ||
t1e integer, | ||
t1f integer | ||
) USING parquet | ||
-- !query analysis | ||
CreateDataSourceTableCommand `spark_catalog`.`default`.`i1_tbl`, false | ||
|
||
|
||
-- !query | ||
CREATE TABLE i2_tbl ( | ||
t2a integer, | ||
t2b integer, | ||
t2c integer, | ||
t2d integer, | ||
t2e integer, | ||
t2f integer | ||
) USING parquet | ||
-- !query analysis | ||
CreateDataSourceTableCommand `spark_catalog`.`default`.`i2_tbl`, false | ||
|
||
|
||
-- !query | ||
CREATE TABLE i3_tbl ( | ||
t3a integer, | ||
t3b integer, | ||
t3c integer, | ||
t3d integer, | ||
t3e integer, | ||
t3f integer | ||
) USING parquet | ||
-- !query analysis | ||
CreateDataSourceTableCommand `spark_catalog`.`default`.`i3_tbl`, false | ||
|
||
|
||
-- !query | ||
select i3_tbl.* from ( | ||
select * from i1_tbl left semi join (select * from i2_tbl where t2a > 1000) tmp2 on i1_tbl.t1a = tmp2.t2a | ||
) tmp1 join i3_tbl on tmp1.t1a = i3_tbl.t3a | ||
-- !query analysis | ||
Project [t3a#x, t3b#x, t3c#x, t3d#x, t3e#x, t3f#x] | ||
+- Join Inner, (t1a#x = t3a#x) | ||
:- SubqueryAlias tmp1 | ||
: +- Project [t1a#x, t1b#x, t1c#x, t1d#x, t1e#x, t1f#x] | ||
: +- Join LeftSemi, (t1a#x = t2a#x) | ||
: :- SubqueryAlias spark_catalog.default.i1_tbl | ||
: : +- Relation spark_catalog.default.i1_tbl[t1a#x,t1b#x,t1c#x,t1d#x,t1e#x,t1f#x] parquet | ||
: +- SubqueryAlias tmp2 | ||
: +- Project [t2a#x, t2b#x, t2c#x, t2d#x, t2e#x, t2f#x] | ||
: +- Filter (t2a#x > 1000) | ||
: +- SubqueryAlias spark_catalog.default.i2_tbl | ||
: +- Relation spark_catalog.default.i2_tbl[t2a#x,t2b#x,t2c#x,t2d#x,t2e#x,t2f#x] parquet | ||
+- SubqueryAlias spark_catalog.default.i3_tbl | ||
+- Relation spark_catalog.default.i3_tbl[t3a#x,t3b#x,t3c#x,t3d#x,t3e#x,t3f#x] parquet | ||
|
||
|
||
-- !query | ||
select * from i1_tbl join i2_tbl on t1a = t2a and t2a = t1b and t1b = t2b and t2b = t1c and t1c = t2c and t2c = t1d and t1d = t2d and t2d = t1e and t1e = t2e and t2e = t1f | ||
-- !query analysis | ||
Project [t1a#x, t1b#x, t1c#x, t1d#x, t1e#x, t1f#x, t2a#x, t2b#x, t2c#x, t2d#x, t2e#x, t2f#x] | ||
+- Join Inner, (((((t1a#x = t2a#x) AND (t2a#x = t1b#x)) AND (t1b#x = t2b#x)) AND ((t2b#x = t1c#x) AND (t1c#x = t2c#x))) AND ((((t2c#x = t1d#x) AND (t1d#x = t2d#x)) AND (t2d#x = t1e#x)) AND ((t1e#x = t2e#x) AND (t2e#x = t1f#x)))) | ||
:- SubqueryAlias spark_catalog.default.i1_tbl | ||
: +- Relation spark_catalog.default.i1_tbl[t1a#x,t1b#x,t1c#x,t1d#x,t1e#x,t1f#x] parquet | ||
+- SubqueryAlias spark_catalog.default.i2_tbl | ||
+- Relation spark_catalog.default.i2_tbl[t2a#x,t2b#x,t2c#x,t2d#x,t2e#x,t2f#x] parquet | ||
|
||
|
||
-- !query | ||
DROP TABLE i1_tbl | ||
-- !query analysis | ||
DropTable false, false | ||
+- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.i1_tbl | ||
|
||
|
||
-- !query | ||
DROP TABLE i2_tbl | ||
-- !query analysis | ||
DropTable false, false | ||
+- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.i2_tbl | ||
|
||
|
||
-- !query | ||
DROP TABLE i3_tbl | ||
-- !query analysis | ||
DropTable false, false | ||
+- ResolvedIdentifier V2SessionCatalog(spark_catalog), default.i3_tbl |
38 changes: 38 additions & 0 deletions
38
sql/core/src/test/resources/sql-tests/inputs/infer-filters.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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
CREATE TABLE i1_tbl ( | ||
t1a integer, | ||
t1b integer, | ||
t1c integer, | ||
t1d integer, | ||
t1e integer, | ||
t1f integer | ||
) USING parquet; | ||
|
||
CREATE TABLE i2_tbl ( | ||
t2a integer, | ||
t2b integer, | ||
t2c integer, | ||
t2d integer, | ||
t2e integer, | ||
t2f integer | ||
) USING parquet; | ||
|
||
CREATE TABLE i3_tbl ( | ||
t3a integer, | ||
t3b integer, | ||
t3c integer, | ||
t3d integer, | ||
t3e integer, | ||
t3f integer | ||
) USING parquet; | ||
|
||
|
||
select i3_tbl.* from ( | ||
select * from i1_tbl left semi join (select * from i2_tbl where t2a > 1000) tmp2 on i1_tbl.t1a = tmp2.t2a | ||
) tmp1 join i3_tbl on tmp1.t1a = i3_tbl.t3a; | ||
|
||
|
||
select * from i1_tbl join i2_tbl on t1a = t2a and t2a = t1b and t1b = t2b and t2b = t1c and t1c = t2c and t2c = t1d and t1d = t2d and t2d = t1e and t1e = t2e and t2e = t1f; | ||
|
||
DROP TABLE i1_tbl; | ||
DROP TABLE i2_tbl; | ||
DROP TABLE i3_tbl; |
86 changes: 86 additions & 0 deletions
86
sql/core/src/test/resources/sql-tests/results/infer-filters.sql.out
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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
-- Automatically generated by SQLQueryTestSuite | ||
-- !query | ||
CREATE TABLE i1_tbl ( | ||
t1a integer, | ||
t1b integer, | ||
t1c integer, | ||
t1d integer, | ||
t1e integer, | ||
t1f integer | ||
) USING parquet | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
CREATE TABLE i2_tbl ( | ||
t2a integer, | ||
t2b integer, | ||
t2c integer, | ||
t2d integer, | ||
t2e integer, | ||
t2f integer | ||
) USING parquet | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
CREATE TABLE i3_tbl ( | ||
t3a integer, | ||
t3b integer, | ||
t3c integer, | ||
t3d integer, | ||
t3e integer, | ||
t3f integer | ||
) USING parquet | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
select i3_tbl.* from ( | ||
select * from i1_tbl left semi join (select * from i2_tbl where t2a > 1000) tmp2 on i1_tbl.t1a = tmp2.t2a | ||
) tmp1 join i3_tbl on tmp1.t1a = i3_tbl.t3a | ||
-- !query schema | ||
struct<t3a:int,t3b:int,t3c:int,t3d:int,t3e:int,t3f:int> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
select * from i1_tbl join i2_tbl on t1a = t2a and t2a = t1b and t1b = t2b and t2b = t1c and t1c = t2c and t2c = t1d and t1d = t2d and t2d = t1e and t1e = t2e and t2e = t1f | ||
-- !query schema | ||
struct<t1a:int,t1b:int,t1c:int,t1d:int,t1e:int,t1f:int,t2a:int,t2b:int,t2c:int,t2d:int,t2e:int,t2f:int> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
DROP TABLE i1_tbl | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
DROP TABLE i2_tbl | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
||
|
||
|
||
-- !query | ||
DROP TABLE i3_tbl | ||
-- !query schema | ||
struct<> | ||
-- !query output | ||
|
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
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
Oops, something went wrong.