Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
Signed-off-by: Yuchen Liang <[email protected]>
  • Loading branch information
yliang412 committed Mar 9, 2024
1 parent aa8041f commit f268eb1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
8 changes: 6 additions & 2 deletions optd-core/src/cascades/memo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,11 @@ impl<T: RelNodeTyp> Memo<T> {
bail!("no best group binding for group {}", group_id)
}

pub fn get_best_group_binding(&self, group_id: GroupId, meta: &mut Option<RelNodeMetaMap>) -> Result<RelNodeRef<T>> {
pub fn get_best_group_binding(
&self,
group_id: GroupId,
meta: &mut Option<RelNodeMetaMap>,
) -> Result<RelNodeRef<T>> {
let info = self.get_group_info(group_id);
if let Some(winner) = info.winner {
if !winner.impossible {
Expand All @@ -486,7 +490,7 @@ impl<T: RelNodeTyp> Memo<T> {
children,
data: expr.data.clone(),
});

if let Some(meta) = meta {
meta.insert(
node.as_ref() as *const _ as usize,
Expand Down
6 changes: 5 additions & 1 deletion optd-core/src/cascades/optimizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,11 @@ impl<T: RelNodeTyp> CascadesOptimizer<T> {
}

/// Gets the group binding.
pub fn step_get_optimize_rel(&self, group_id: GroupId, meta: &mut Option<RelNodeMetaMap>) -> Result<RelNodeRef<T>> {
pub fn step_get_optimize_rel(
&self,
group_id: GroupId,
meta: &mut Option<RelNodeMetaMap>,
) -> Result<RelNodeRef<T>> {
self.memo.get_best_group_binding(group_id, meta)
}

Expand Down
4 changes: 1 addition & 3 deletions optd-datafusion-repr/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,7 @@ impl DatafusionOptimizer {
let group_id = self.optimizer.step_optimize_rel(root_rel)?;

let mut meta = Some(HashMap::new());
let optimized_rel = self
.optimizer
.step_get_optimize_rel(group_id, &mut meta)?;
let optimized_rel = self.optimizer.step_get_optimize_rel(group_id, &mut meta)?;

Ok((group_id, optimized_rel, meta.unwrap()))
}
Expand Down

0 comments on commit f268eb1

Please sign in to comment.