-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Enhancement] Add DrivingTableSelectionRule
#55513
base: main
Are you sure you want to change the base?
Conversation
DrivingTableSelectionRule
DrivingTableSelectionRule
393cf57
to
c98645b
Compare
well done, can you rebase again? |
create table T1 properties("replication_num"="1") as select * from T; | ||
create table T2 properties("replication_num"="1") as select * from T; | ||
|
||
explain select * from T where T.a = (select a from T0) or T.b = (select b from T1) or T.c = (select c from T2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- it's better to not
explain
this directly, you can referassert_explain_contains
in sql-tests
function: assert_explain_contains('SELECT COUNT(*) FROM partitions_multi_column_1 WHERE c1=1 AND TRUE', 'partitions=1/3')
- it's better to add some specific data and check rewrite result fine.
Signed-off-by: Kould <[email protected]>
Signed-off-by: Kould <[email protected]>
c98645b
to
083fe6b
Compare
1 1 1 | ||
1 1 1 | ||
-- !result | ||
explain select * from T where T.a = (select a from T0) or T.b = (select b from T1) or T.c = (select c from T2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you only want to test the explain, you could add test cases in the FE code like PlanFragmentWithCostTest
. which will be easier to debug and test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, but I think it is better not to explain in this e2e test (fe ut has been verified)
Signed-off-by: Kould <[email protected]>
083fe6b
to
100c710
Compare
Quality Gate passedIssues Measures |
I tried to run the failed unit test in CI locally but it passed locally. Do you have any solution? |
this test case is not stable, i already rerun this pr's ci |
[Java-Extensions Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
[FE Incremental Coverage Report]✅ pass : 179 / 195 (91.79%) file detail
|
[BE Incremental Coverage Report]✅ pass : 0 / 0 (0%) |
Why I'm doing:
#52399
support similar to #55376: If the table and driving table are only in an OR relationship, cross join is converted to union all
What I'm doing:
DrivingTableSelectionRule
is used to adjust the position of the driving table according to the on predicate of the inner join when multiple tables are cross joined and the root is an inner join. Reduce the overhead caused by Join in this caseImplementation idea:
Analyze the corresponding relationship between the tables of the two columns in the BinaryPredicateOperator through the on predicate of the inner join, and establish an undirected graph. When all edges only have the same table as the endpoint, the table is a driving table, which is the top layer of the inner join table to replace(if the replaced node is not the driving table)
What type of PR is this:
Does this PR entail a change in behavior?
If yes, please specify the type of change:
Checklist:
Bugfix cherry-pick branch check: