-
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.
fix(cost): return full selectivity for self joins (#201)
will go after #200 Signed-off-by: Alex Chi <[email protected]> Co-authored-by: Benjamin Owad <[email protected]>
- Loading branch information
Showing
4 changed files
with
55 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
-- (no id or description) | ||
create table t1(t1v1 int, t1v2 int); | ||
create table t2(t2v1 int, t2v3 int); | ||
insert into t1 values (0, 0), (1, 1), (2, 2); | ||
insert into t2 values (0, 200), (1, 201), (2, 202); | ||
|
||
/* | ||
3 | ||
3 | ||
*/ | ||
|
||
-- test self join | ||
select * from t1 as a, t1 as b where a.t1v1 = b.t1v1; | ||
|
||
/* | ||
LogicalProjection { exprs: [ #0, #1, #2, #3 ] } | ||
└── LogicalFilter | ||
├── cond:Eq | ||
│ ├── #0 | ||
│ └── #2 | ||
└── LogicalJoin { join_type: Cross, cond: true } | ||
├── LogicalScan { table: t1 } | ||
└── LogicalScan { table: t1 } | ||
PhysicalHashJoin { join_type: Inner, left_keys: [ #0 ], right_keys: [ #0 ] } | ||
├── PhysicalScan { table: t1 } | ||
└── PhysicalScan { table: t1 } | ||
0 0 0 0 | ||
1 1 1 1 | ||
2 2 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,13 @@ | ||
- sql: | | ||
create table t1(t1v1 int, t1v2 int); | ||
create table t2(t2v1 int, t2v3 int); | ||
insert into t1 values (0, 0), (1, 1), (2, 2); | ||
insert into t2 values (0, 200), (1, 201), (2, 202); | ||
tasks: | ||
- execute | ||
- sql: | | ||
select * from t1 as a, t1 as b where a.t1v1 = b.t1v1; | ||
desc: test self join | ||
tasks: | ||
- explain:logical_optd,physical_optd | ||
- execute |