Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
andygrove committed Dec 14, 2024
1 parent 7714edc commit 912c527
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions src/query_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,6 @@ pub struct QueryStage {
pub plan: Arc<dyn ExecutionPlan>,
}

fn _get_output_partition_count(plan: &dyn ExecutionPlan) -> usize {
// UnknownPartitioning and HashPartitioning with empty expressions will
// both return 1 partition.
match plan.properties().output_partitioning() {
Partitioning::UnknownPartitioning(_) => 1,
Partitioning::Hash(expr, _) if expr.is_empty() => 1,
p => p.partition_count(),
}
}

impl QueryStage {
pub fn new(id: usize, plan: Arc<dyn ExecutionPlan>) -> Self {
Self { id, plan }
Expand All @@ -110,7 +100,13 @@ impl QueryStage {
}

pub fn get_output_partition_count(&self) -> usize {
_get_output_partition_count(self.plan.as_ref())
// UnknownPartitioning and HashPartitioning with empty expressions will
// both return 1 partition.
match self.plan.properties().output_partitioning() {
Partitioning::UnknownPartitioning(_) => 1,
Partitioning::Hash(expr, _) if expr.is_empty() => 1,
p => p.partition_count(),
}
}
}

Expand Down

0 comments on commit 912c527

Please sign in to comment.