Skip to content

Commit d2b97de

Browse files
committed
fix(ci): restore rule-name error context in analysis phase, fix broken doc links, format Cargo.toml
1 parent 7124d84 commit d2b97de

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

datafusion/optimizer/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ recursive_protection = ["dep:recursive"]
5353
# traits).
5454
[dependencies]
5555
arrow = { workspace = true }
56+
async-trait = { workspace = true }
5657
chrono = { workspace = true }
5758
datafusion-common = { workspace = true, default-features = true }
5859
datafusion-expr = { workspace = true }
@@ -61,7 +62,6 @@ datafusion-physical-expr = { workspace = true }
6162
indexmap = { workspace = true }
6263
itertools = { workspace = true }
6364
log = { workspace = true }
64-
async-trait = { workspace = true }
6565
recursive = { workspace = true, optional = true }
6666
regex = { workspace = true }
6767
regex-syntax = "0.8.9"

datafusion/optimizer/src/logical_pipeline/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// under the License.
1717

1818
//! [`LogicalPlanningPipeline`]: an ordered sequence of named [`Phase`]s that
19-
//! transform a [`LogicalPlan`] before physical planning.
19+
//! transform a `LogicalPlan` before physical planning.
2020
//!
2121
//! Inspired by Spark SQL's `Batch(name, strategy, rules)` model.
2222
@@ -55,12 +55,10 @@ pub enum Strategy {
5555
/// Apply each rule exactly once. No convergence check is performed.
5656
Once,
5757
/// Repeat until the plan stops changing or `max_passes` iterations are
58-
/// reached. Convergence is detected via [`LogicalPlanSignature`] so the
58+
/// reached. Convergence is detected via a plan signature hash so the
5959
/// loop exits early as soon as a full pass produces no change.
6060
///
6161
/// `max_passes: None` defers to `config.optimizer.max_passes` at runtime.
62-
///
63-
/// [`LogicalPlanSignature`]: crate::plan_signature::LogicalPlanSignature
6462
FixedPoint { max_passes: Option<usize> },
6563
}
6664

datafusion/optimizer/src/logical_pipeline/sync_phase.rs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,14 @@ impl SyncAnalysisPhase {
152152

153153
'outer: for _ in 0..passes {
154154
if let Some(rule) = &fn_rewrite_rule {
155-
plan = rule.analyze(plan, config)?;
155+
plan = rule
156+
.analyze(plan, config)
157+
.map_err(|e| e.context(rule.name()))?;
156158
}
157159
for rule in &self.rules {
158-
plan = rule.analyze(plan, config)?;
160+
plan = rule
161+
.analyze(plan, config)
162+
.map_err(|e| e.context(rule.name()))?;
159163
}
160164
if !previous_plans.insert(LogicalPlanSignature::new(&plan)) {
161165
break 'outer;
@@ -202,11 +206,15 @@ impl SyncAnalysisPhase {
202206

203207
'outer: for _ in 0..passes {
204208
if let Some(rule) = &fn_rewrite_rule {
205-
plan = rule.analyze(plan, config)?;
209+
plan = rule
210+
.analyze(plan, config)
211+
.map_err(|e| e.context(rule.name()))?;
206212
observer(&plan, rule.name());
207213
}
208214
for rule in &self.rules {
209-
plan = rule.analyze(plan, config)?;
215+
plan = rule
216+
.analyze(plan, config)
217+
.map_err(|e| e.context(rule.name()))?;
210218
observer(&plan, rule.name());
211219
}
212220
if !previous_plans.insert(LogicalPlanSignature::new(&plan)) {
@@ -224,7 +232,7 @@ impl SyncAnalysisPhase {
224232
impl SyncPhase<dyn OptimizerRule + Send + Sync> {
225233
/// Apply all optimization rules in order, respecting [`ApplyOrder`] recursion.
226234
///
227-
/// Uses [`LogicalPlanSignature`] to detect fixpoint convergence early.
235+
/// Uses a plan signature hash to detect fixpoint convergence early.
228236
/// Checks plan invariants before the first pass and schema invariants after
229237
/// each rule.
230238
pub fn apply(

0 commit comments

Comments
 (0)