forked from risingwavelabs/risingwave
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(optimizer): support covered index selection for index join (risi…
…ngwavelabs#6645) support covered index selection for index join Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
04514b8
commit 8103a13
Showing
5 changed files
with
154 additions
and
23 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,38 @@ | ||
statement ok | ||
SET RW_IMPLICIT_FLUSH TO true; | ||
|
||
statement ok | ||
create table t (a int, b int); | ||
|
||
statement ok | ||
create table t2 (c int, d int); | ||
|
||
statement ok | ||
create index idx on t2(d) include (c); | ||
|
||
statement ok | ||
create index idx2 on t2(c, d); | ||
|
||
statement ok | ||
insert into t values(1, 111), (2, 222); | ||
|
||
statement ok | ||
insert into t2 values(1, 111), (2, 222); | ||
|
||
query IIII rowsort | ||
select * from t join t2 on t.b = t2.d; | ||
---- | ||
1 111 1 111 | ||
2 222 2 222 | ||
|
||
query IIII rowsort | ||
select * from t join t2 on t.a = t2.c and t.b = t2.d; | ||
---- | ||
1 111 1 111 | ||
2 222 2 222 | ||
|
||
statement ok | ||
drop table t; | ||
|
||
statement ok | ||
drop table t2; |
25 changes: 25 additions & 0 deletions
25
src/frontend/planner_test/tests/testdata/batch_index_join.yaml
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,25 @@ | ||
# This file is automatically generated. See `src/frontend/planner_test/README.md` for more information. | ||
- sql: | | ||
set rw_batch_enable_lookup_join = true; | ||
create table t (a int, b int); | ||
create table t2 (c int, d int); | ||
create index idx on t2(d) include (c); | ||
select * from t join t2 on t.b = t2.d; | ||
batch_plan: | | ||
BatchExchange { order: [], dist: Single } | ||
└─BatchLookupJoin { type: Inner, predicate: t.b = idx.d, output: all } | ||
└─BatchExchange { order: [], dist: UpstreamHashShard(t.b) } | ||
└─BatchScan { table: t, columns: [t.a, t.b], distribution: SomeShard } | ||
- sql: | | ||
set rw_batch_enable_lookup_join = true; | ||
create table t (a int, b int); | ||
create table t2 (c int, d int); | ||
create index idx on t2(d) include (c); | ||
create index idx2 on t2(c, d); | ||
create index idx3 on t2(c) include(d); | ||
select * from t join t2 on t.a = t2.c and t.b = t2.d; | ||
batch_plan: | | ||
BatchExchange { order: [], dist: Single } | ||
└─BatchLookupJoin { type: Inner, predicate: t.a = idx2.c AND t.b = idx2.d, output: all } | ||
└─BatchExchange { order: [], dist: UpstreamHashShard(t.a, t.b) } | ||
└─BatchScan { table: t, columns: [t.a, t.b], distribution: SomeShard } |
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