Skip to content

Commit

Permalink
test(planner): add predicata push down planner test (risingwavelabs#6578
Browse files Browse the repository at this point in the history
)

* add predicate push down planner test

* add com comments

* fix mistake

* dedup test case

* dedup test case

* improve test for agg/proj

* add todo

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
st1page and mergify[bot] authored Nov 28, 2022
1 parent a198200 commit 465b238
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 80 deletions.
27 changes: 0 additions & 27 deletions src/frontend/planner_test/tests/testdata/join.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,33 +143,6 @@
| └─BatchScan { table: bc, columns: [bc.b, bc.c], distribution: SomeShard }
└─BatchExchange { order: [], dist: HashShard(ca.c) }
└─BatchScan { table: ca, columns: [ca.c, ca.a], distribution: SomeShard }
- name: Only push to left
sql: |
create table t1 (v1 int, v2 int);
create table t2 (v1 int, v2 int);
select * from t1 left join t2 where t1.v2 > 100;
optimized_logical_plan: |
LogicalJoin { type: LeftOuter, on: true, output: all }
├─LogicalScan { table: t1, output_columns: [t1.v1, t1.v2], required_columns: [v1, v2], predicate: (t1.v2 > 100:Int32) }
└─LogicalScan { table: t2, columns: [t2.v1, t2.v2] }
- name: Only push to right
sql: |
create table t1 (v1 int, v2 int);
create table t2 (v1 int, v2 int);
select * from t1 right join t2 where t2.v2 > 100;
optimized_logical_plan: |
LogicalJoin { type: LeftOuter, on: true, output: [t1.v1, t1.v2, t2.v1, t2.v2] }
├─LogicalScan { table: t2, output_columns: [t2.v1, t2.v2], required_columns: [v1, v2], predicate: (t2.v2 > 100:Int32) }
└─LogicalScan { table: t1, columns: [t1.v1, t1.v2] }
- name: Push to left, right and on
sql: |
create table t1 (v1 int, v2 int);
create table t2 (v1 int, v2 int);
select * from t1, t2 where t1.v1 > 100 and t2.v1 < 1000 and t1.v2 = t2.v2;
optimized_logical_plan: |
LogicalJoin { type: Inner, on: (t1.v2 = t2.v2), output: all }
├─LogicalScan { table: t1, output_columns: [t1.v1, t1.v2], required_columns: [v1, v2], predicate: (t1.v1 > 100:Int32) }
└─LogicalScan { table: t2, output_columns: [t2.v1, t2.v2], required_columns: [v1, v2], predicate: (t2.v1 < 1000:Int32) }
- name: Left & right has same SomeShard distribution. There should still be exchanges below hash join
sql: |
create table t(x int);
Expand Down
Loading

0 comments on commit 465b238

Please sign in to comment.