Skip to content

Commit

Permalink
refactor(core): rewrite tasks using generators, better pruning (#265)
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi Z <iskyzh@gmail.com>
  • Loading branch information
skyzh committed Dec 18, 2024
1 parent 254b2e8 commit 583adab
Show file tree
Hide file tree
Showing 43 changed files with 1,510 additions and 1,393 deletions.
110 changes: 100 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions optd-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ serde = { version = "1.0", features = ["derive", "rc"] }
arrow-schema = "53.3.0"
chrono = "0.4"
erased-serde = "0.4"
pollster = "0.4"
stacker = "0.1"

[dev-dependencies]
pretty_assertions = "1.4.1"
4 changes: 2 additions & 2 deletions optd-core/src/cascades.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
mod memo;
mod optimizer;
mod tasks;
pub mod rule_match;
mod tasks2;

pub use memo::{Memo, NaiveMemo};
pub use optimizer::{CascadesOptimizer, ExprId, GroupId, OptimizerProperties, RelNodeContext};
use tasks::Task;
5 changes: 5 additions & 0 deletions optd-core/src/cascades/memo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ pub trait Memo<T: NodeType>: 'static + Send + Sync {
) -> Result<ArcPlanNode<T>> {
get_best_group_binding_inner(self, group_id, &mut post_process)
}

/// Get winner of a group and a subgroup.
fn get_group_winner(&self, group_id: GroupId) -> &Winner {
&self.get_group(group_id).info.winner
}
}

fn get_best_group_binding_inner<M: Memo<T> + ?Sized, T: NodeType>(
Expand Down
Loading

0 comments on commit 583adab

Please sign in to comment.