Skip to content

Commit 91c8a47

Browse files
authored
Require Debug for PhysicalOptimizerRule (#12624)
* Require Debug for PhysicalOptimizerRule * Add reference to meet &JoinType type required * Revert "Add reference to meet &JoinType type required" as clippy lint informs this is unnecessary This reverts commit f69d73c.
1 parent b55da25 commit 91c8a47

14 files changed

+15
-12
lines changed

datafusion/core/src/physical_optimizer/coalesce_batches.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use datafusion_physical_optimizer::PhysicalOptimizerRule;
3434

3535
/// Optimizer rule that introduces CoalesceBatchesExec to avoid overhead with small batches that
3636
/// are produced by highly selective filters
37-
#[derive(Default)]
37+
#[derive(Default, Debug)]
3838
pub struct CoalesceBatches {}
3939

4040
impl CoalesceBatches {

datafusion/core/src/physical_optimizer/enforce_distribution.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ use itertools::izip;
176176
///
177177
/// This rule only chooses the exact match and satisfies the Distribution(a, b, c)
178178
/// by a HashPartition(a, b, c).
179-
#[derive(Default)]
179+
#[derive(Default, Debug)]
180180
pub struct EnforceDistribution {}
181181

182182
impl EnforceDistribution {

datafusion/core/src/physical_optimizer/enforce_sorting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ use itertools::izip;
7272

7373
/// This rule inspects [`SortExec`]'s in the given physical plan and removes the
7474
/// ones it can prove unnecessary.
75-
#[derive(Default)]
75+
#[derive(Default, Debug)]
7676
pub struct EnforceSorting {}
7777

7878
impl EnforceSorting {

datafusion/core/src/physical_optimizer/join_selection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use datafusion_physical_optimizer::PhysicalOptimizerRule;
4646
/// The [`JoinSelection`] rule tries to modify a given plan so that it can
4747
/// accommodate infinite sources and optimize joins in the plan according to
4848
/// available statistical information, if there is any.
49-
#[derive(Default)]
49+
#[derive(Default, Debug)]
5050
pub struct JoinSelection {}
5151

5252
impl JoinSelection {

datafusion/core/src/physical_optimizer/optimizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ use crate::physical_optimizer::sanity_checker::SanityCheckPlan;
3535
use crate::physical_optimizer::topk_aggregation::TopKAggregation;
3636

3737
/// A rule-based physical optimizer.
38-
#[derive(Clone)]
38+
#[derive(Clone, Debug)]
3939
pub struct PhysicalOptimizer {
4040
/// All rules to apply
4141
pub rules: Vec<Arc<dyn PhysicalOptimizerRule + Send + Sync>>,

datafusion/core/src/physical_optimizer/projection_pushdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ use itertools::Itertools;
6060

6161
/// This rule inspects [`ProjectionExec`]'s in the given physical plan and tries to
6262
/// remove or swap with its child.
63-
#[derive(Default)]
63+
#[derive(Default, Debug)]
6464
pub struct ProjectionPushdown {}
6565

6666
impl ProjectionPushdown {

datafusion/core/src/physical_optimizer/sanity_checker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ use itertools::izip;
4141
/// are not satisfied by their children.
4242
/// 2. Plans that use pipeline-breaking operators on infinite input(s),
4343
/// it is impossible to execute such queries (they will never generate output nor finish)
44-
#[derive(Default)]
44+
#[derive(Default, Debug)]
4545
pub struct SanityCheckPlan {}
4646

4747
impl SanityCheckPlan {

datafusion/core/src/physical_optimizer/update_aggr_exprs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ use datafusion_physical_plan::{
4848
/// This rule analyzes aggregate expressions of type `Beneficial` to see whether
4949
/// their input ordering requirements are satisfied. If this is the case, the
5050
/// aggregators are modified to run in a more efficient mode.
51-
#[derive(Default)]
51+
#[derive(Default, Debug)]
5252
pub struct OptimizeAggregateOrder {}
5353

5454
impl OptimizeAggregateOrder {

datafusion/physical-optimizer/src/aggregate_statistics.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use datafusion_physical_plan::placeholder_row::PlaceholderRowExec;
3333
use datafusion_physical_plan::udaf::AggregateFunctionExpr;
3434

3535
/// Optimizer that uses available statistics for aggregate functions
36-
#[derive(Default)]
36+
#[derive(Default, Debug)]
3737
pub struct AggregateStatistics {}
3838

3939
impl AggregateStatistics {

datafusion/physical-optimizer/src/combine_partial_final_agg.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ use datafusion_physical_expr::{physical_exprs_equal, PhysicalExpr};
3737
///
3838
/// This rule should be applied after the EnforceDistribution and EnforceSorting rules
3939
///
40-
#[derive(Default)]
40+
#[derive(Default, Debug)]
4141
pub struct CombinePartialFinalAggregate {}
4242

4343
impl CombinePartialFinalAggregate {

datafusion/physical-optimizer/src/limit_pushdown.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ use datafusion_physical_plan::{ExecutionPlan, ExecutionPlanProperties};
3333

3434
/// This rule inspects [`ExecutionPlan`]'s and pushes down the fetch limit from
3535
/// the parent to the child if applicable.
36-
#[derive(Default)]
36+
#[derive(Default, Debug)]
3737
pub struct LimitPushdown {}
3838

3939
/// This is a "data class" we use within the [`LimitPushdown`] rule to push

datafusion/physical-optimizer/src/limited_distinct_aggregation.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ use itertools::Itertools;
3535
/// rows in the group to be processed for correctness. Example queries fitting this description are:
3636
/// - `SELECT distinct l_orderkey FROM lineitem LIMIT 10;`
3737
/// - `SELECT l_orderkey FROM lineitem GROUP BY l_orderkey LIMIT 10;`
38+
#[derive(Debug)]
3839
pub struct LimitedDistinctAggregation {}
3940

4041
impl LimitedDistinctAggregation {

datafusion/physical-optimizer/src/optimizer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use datafusion_common::config::ConfigOptions;
2121
use datafusion_common::Result;
2222
use datafusion_physical_plan::ExecutionPlan;
23+
use std::fmt::Debug;
2324
use std::sync::Arc;
2425

2526
/// `PhysicalOptimizerRule` transforms one ['ExecutionPlan'] into another which
@@ -29,7 +30,7 @@ use std::sync::Arc;
2930
/// `PhysicalOptimizerRule`s.
3031
///
3132
/// [`SessionState::add_physical_optimizer_rule`]: https://docs.rs/datafusion/latest/datafusion/execution/session_state/struct.SessionState.html#method.add_physical_optimizer_rule
32-
pub trait PhysicalOptimizerRule {
33+
pub trait PhysicalOptimizerRule: Debug {
3334
/// Rewrite `plan` to an optimized form
3435
fn optimize(
3536
&self,

datafusion/physical-optimizer/src/topk_aggregation.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ use crate::PhysicalOptimizerRule;
3737
use itertools::Itertools;
3838

3939
/// An optimizer rule that passes a `limit` hint to aggregations if the whole result is not needed
40+
#[derive(Debug)]
4041
pub struct TopKAggregation {}
4142

4243
impl TopKAggregation {

0 commit comments

Comments
 (0)