-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add cross-product test and enable more explain options (#50)
* test: add cross-product test and enable more options Signed-off-by: Yuchen Liang <yuchenl3@andrew.cmu.edu> * add tasks to use datafusion optimizer Signed-off-by: Yuchen Liang <yuchenl3@andrew.cmu.edu> * change join_enumerate task types Signed-off-by: Yuchen Liang <yuchenl3@andrew.cmu.edu> * restore planner tests Signed-off-by: Yuchen Liang <yuchenl3@andrew.cmu.edu> --------- Signed-off-by: Yuchen Liang <yuchenl3@andrew.cmu.edu>
- Loading branch information
Showing
7 changed files
with
277 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
= Usage | ||
|
||
**Update the test cases** | ||
|
||
```shell | ||
cargo run -p optd-sqlplannertest --bin planner_test_apply | ||
``` | ||
|
||
**Verify the test cases** | ||
|
||
```shell | ||
cargo test -p optd-sqlplannertest | ||
# or use nextest | ||
cargo nextest run -p optd-sqlplannertest | ||
``` | ||
|
||
The `explain` and `execute` task will be run with datafusion's logical optimizer disabled. To keep using datafusion's logical optimizer, you could use the `execute_with_logical` and `explain_with_logical` tasks instead. | ||
|
||
Currently we have the following options for the explain task: | ||
|
||
- `logical_datafusion`: datafusion's logical plan. | ||
- `logical_optd`: optd's logical plan before optimization. | ||
- `physical_optd`: optd's physical plan after optimization. | ||
- `physical_datafusion`: datafusion's physical plan. | ||
- `join_orders`: physical join orders. | ||
- `logical_join_orders`: logical join orders. | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
-- (no id or description) | ||
create table t1(t1v1 int); | ||
create table t2(t2v1 int); | ||
insert into t1 values (0), (1), (2); | ||
insert into t2 values (0), (1), (2); | ||
|
||
/* | ||
3 | ||
3 | ||
*/ | ||
|
||
-- Test optimizer logical for a cross product. | ||
select * from t1, t2; | ||
|
||
/* | ||
LogicalProjection { exprs: [ #0, #1 ] } | ||
└── LogicalJoin { join_type: Cross, cond: true } | ||
├── LogicalScan { table: t1 } | ||
└── LogicalScan { table: t2 } | ||
PhysicalProjection { exprs: [ #0, #1 ] } | ||
└── PhysicalNestedLoopJoin { join_type: Cross, cond: true } | ||
├── PhysicalScan { table: t1 } | ||
└── PhysicalScan { table: t2 } | ||
0 0 | ||
0 1 | ||
0 2 | ||
1 0 | ||
1 1 | ||
1 2 | ||
2 0 | ||
2 1 | ||
2 2 | ||
*/ | ||
|
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,14 @@ | ||
- sql: | | ||
create table t1(t1v1 int); | ||
create table t2(t2v1 int); | ||
insert into t1 values (0), (1), (2); | ||
insert into t2 values (0), (1), (2); | ||
tasks: | ||
- execute | ||
- sql: | | ||
select * from t1, t2; | ||
desc: Test optimizer logical for a cross product. | ||
tasks: | ||
- explain:logical_optd,physical_optd | ||
- execute | ||
|
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.