RBO Optimizer implementation#45
Merged
KKould merged 18 commits intoKipData:mainfrom Aug 17, 2023
Merged
Conversation
…`HepGraph` TODO: HepGraph::to_plan
… matching `OptExpr` in the `HepGraph`
… `HepOptimizer` rules are divided into `RuleBatch` for matching and apply
…itional scanning
…g`, `PhysicalPlanMapping` avoids `clone` and reduces performance overhead
…ction and Limit offset
…HILD_RULE` Rule to push down the Project to reduce the IO generated by redundant columns
…E` and `COMBINE_FILTERS_RULE` to minimize the calculation amount of Projection and merge Filter calculation
…e the related structure of the Limit operator
…ush the Filter condition before the Join, and only works for the JoinType of Inner/Left/Right
lewiszlw
reviewed
Aug 16, 2023
| predicate: |op| match op { | ||
| Operator::Limit(_) => true, | ||
| _ => false | ||
| }, |
Member
There was a problem hiding this comment.
Could simplify code with matches!
lewiszlw
reviewed
Aug 16, 2023
| } | ||
| } | ||
|
|
||
| /// Push down `Limit` past a `Project`. |
lewiszlw
reviewed
Aug 16, 2023
| } | ||
|
|
||
| /// Push down `Limit` past a `Project`. | ||
| pub struct PushLimitIntoTableScan; |
Member
There was a problem hiding this comment.
Suggested change
| pub struct PushLimitIntoTableScan; | |
| pub struct PushLimitIntoScan; |
lewiszlw
reviewed
Aug 16, 2023
Comment on lines
+141
to
+145
| if let Some(grandson_id) = match ty { | ||
| JoinType::Left => Some(graph.children_at(child_id)[0]), | ||
| JoinType::Right => Some(graph.children_at(child_id)[1]), | ||
| _ => None | ||
| } { |
Member
Author
There was a problem hiding this comment.
Miss inner/cross/full join
inner/corss/full cannot be pushed down
Member
There was a problem hiding this comment.
But why comment For INNER and CROSS JOIN, we push limits to both the left and right sides if join condition is empty.
lewiszlw
reviewed
Aug 16, 2023
| #[derive(Debug, PartialEq, Clone)] | ||
| pub struct HepNode { | ||
| node: OptExprNode, | ||
| source_id: Option<HepNodeId>, |
Member
There was a problem hiding this comment.
source_id is really confused, parent_id here seems more readable.
lewiszlw
reviewed
Aug 17, 2023
|
|
||
| #[test] | ||
| fn test_limit_project_transpose() -> Result<()> { | ||
| let plan = select_sql_run("select c1, c2 from t1 limit 1")?; |
Member
There was a problem hiding this comment.
What is this plan? Is project -> limit -> scan? If so, this plan doesn't match LimitProjectTranspose rule.
Member
Author
There was a problem hiding this comment.
project -> limit -> scan
limit -> project -> scan
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What problem does this PR solve?
Add corresponding issue link with summary if exists -->
Issue link:
What is changed and how it works?
Code changes
Check List
Tests
Side effects
Note for reviewer