-
Notifications
You must be signed in to change notification settings - Fork 22
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
[WIP/TODO] RelNode/RexNode (PlanNode/PredNode) separation + more refactors #193
Closed
Conversation
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
… no associated cost
jurplel
force-pushed
the
bowad/core-hacking-rexnode
branch
from
October 27, 2024 18:36
f6d16b7
to
1f1869b
Compare
jurplel
changed the title
[WIP/TODO] RexNode/RelNode (PlanNode/PredNode) separation + more refactors
[WIP/TODO] RelNode/RexNode (PlanNode/PredNode) separation + more refactors
Oct 28, 2024
…re-hacking-rexnode
…re-hacking-rexnode
…re-hacking-rexnode
…re-hacking-rexnode
…re-hacking-rexnode
…re-hacking-rexnode
…re-hacking-rexnode
…re-hacking-rexnode
…re-hacking-rexnode
…re-hacking-rexnode
skyzh
added a commit
that referenced
this pull request
Nov 5, 2024
Extracted from #193, this patch adds predicate to the relnode and refactors the memo table to store the predicates. Minimum changes are done to the df-repr to ensure it still works. Follow-ups: * Rename RelNode -> PlanNode * Rename RelNodeTyp -> PlanNodeTyp * Refactor RelNode to store RelNodeOrGroup * Remove `data` from RelNode Signed-off-by: Alex Chi <[email protected]> Co-authored-by: Benjamin O <[email protected]>
Seeking design feedback. Implemented on `eliminate_limit`, not tested with anything yet. Example expansion: ```rs define_rule!( EliminateLimitRule, apply_eliminate_limit, (Limit, [child], [skip, fetch]) ); ``` -> ```rs // Recursive expansion of define_rule! macro // ========================================== pub struct EliminateLimitRule { matcher:RuleMatcher<DfNodeType>, } impl EliminateLimitRule { pub fn new() -> Self { #[allow(unused_imports)] use DfNodeType::*; let mut pick_num = 0; let matcher = RuleMatcher::MatchNode { typ:Limit,children:(<[_]>::into_vec(#[rustc_box] alloc::boxed::Box::new([(RuleMatcher::PickOne { pick_to:{ let x = pick_num; pick_num+=1; x }, })]))),predicates:(<[_]>::into_vec(#[rustc_box] alloc::boxed::Box::new([(RuleMatcher::PickPred),(RuleMatcher::PickPred)]))), }; let _ = pick_num; Self { matcher } } } pub struct EliminateLimitRulePicks { pub child:PlanNodeOrGroup<DfNodeType>,pub skip:ArcPredNode<DfNodeType>,pub fetch:ArcPredNode<DfNodeType>, } impl <O:Optimizer<DfNodeType>>Rule<DfNodeType,O>for EliminateLimitRule { fn matcher(&self) -> &RuleMatcher<DfNodeType>{ &self.matcher } fn apply(&self,optimizer: &O,mut input:HashMap<usize,PlanNodeOrGroup<DfNodeType>>,mut pred_input:HashMap<usize,ArcPredNode<DfNodeType>>,) -> Vec<PlanNode<DfNodeType>>{ let child:PlanNodeOrGroup<DfNodeType>; ; let skip:ArcPredNode<DfNodeType>; ; let fetch:ArcPredNode<DfNodeType>; ; ; let mut pick_num = 0; let mut pred_pick_num = 0; { child = input.remove(&pick_num).unwrap(); pick_num+=1; }; { skip = pred_input.remove(&pred_pick_num).unwrap(); pred_pick_num+=1; }; { fetch = pred_input.remove(&pred_pick_num).unwrap(); pred_pick_num+=1; }; ; let res; res = pub struct EliminateLimitRulePicks { child,skip,fetch, }; let _ = pick_num; apply_eliminate_limit(optimizer,res) } fn name(&self) -> &'static str { "eliminate_limit_rule" } fn is_impl_rule(&self) -> bool { false } } ```
Signed-off-by: Alex Chi <[email protected]>
Signed-off-by: Alex Chi <[email protected]>
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.
No description provided.