Skip to content

Commit

Permalink
fix order
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Oct 20, 2023
1 parent 5c0d5f9 commit f6e3444
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/frontend/src/optimizer/plan_node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ impl dyn PlanNode {
self.plan_base().order()
}

// TODO: avoid no manual delegation
pub fn distribution(&self) -> &Distribution {
self.plan_base().distribution()
}
Expand Down
6 changes: 4 additions & 2 deletions src/frontend/src/optimizer/property/distribution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,12 @@ impl RequiredDist {

pub fn enforce_if_not_satisfies(
&self,
plan: PlanRef,
mut plan: PlanRef,
required_order: &Order,
) -> Result<PlanRef> {
let plan = required_order.enforce_if_not_satisfies(plan)?;
if let Convention::Batch = plan.convention() {
plan = required_order.enforce_if_not_satisfies(plan)?;
}
if !plan.distribution().satisfies(self) {
Ok(self.enforce(plan, required_order))
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/optimizer/property/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl Order {
}
}

pub fn enforce(&self, plan: PlanRef) -> PlanRef {
fn enforce(&self, plan: PlanRef) -> PlanRef {
assert_eq!(plan.convention(), Convention::Batch);
BatchSort::new(plan, self.clone()).into()
}
Expand Down

0 comments on commit f6e3444

Please sign in to comment.