From 86db8cfd5e0df946adc9ea0436c93120b70949f8 Mon Sep 17 00:00:00 2001 From: Matthew Gapp <61894094+matthewgapp@users.noreply.github.com> Date: Wed, 20 Sep 2023 17:05:25 -0700 Subject: [PATCH] updated variable names to be more descriptive --- .../core/src/physical_optimizer/coalesce_batches.rs | 3 ++- .../src/physical_optimizer/enforce_distribution.rs | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/datafusion/core/src/physical_optimizer/coalesce_batches.rs b/datafusion/core/src/physical_optimizer/coalesce_batches.rs index e3b3f5060f4ca..035a2854f80ca 100644 --- a/datafusion/core/src/physical_optimizer/coalesce_batches.rs +++ b/datafusion/core/src/physical_optimizer/coalesce_batches.rs @@ -67,8 +67,9 @@ impl CoalesceContext { /// Creates a new context for a descendent of this context. /// The descendent will inherit the `has_recursive_ancestor` flag from this context. fn new_descendent(&self, descendent_plan: Arc) -> Self { + let ancestor = self; Self { - has_recursive_ancestor: self.has_recursive_ancestor + has_recursive_ancestor: ancestor.has_recursive_ancestor || is_recursive_query(&descendent_plan), plan: descendent_plan, } diff --git a/datafusion/core/src/physical_optimizer/enforce_distribution.rs b/datafusion/core/src/physical_optimizer/enforce_distribution.rs index 6b71c445419a2..bfb3369abaf81 100644 --- a/datafusion/core/src/physical_optimizer/enforce_distribution.rs +++ b/datafusion/core/src/physical_optimizer/enforce_distribution.rs @@ -1467,16 +1467,20 @@ impl DistributionContext { /// Creates a new context from a descendent plan. /// Importantly, this function propagates the `has_recursive_ancestor` flag. fn new_descendent(&self, descendent_plan: Arc) -> Self { - let mut ctx = Self::new(descendent_plan); - ctx.has_recursive_ancestor |= self.has_recursive_ancestor; - ctx + let ancestor = self; + + let mut new_ctx = Self::new(descendent_plan); + new_ctx.has_recursive_ancestor |= ancestor.has_recursive_ancestor; + new_ctx } /// Creates a new context from a descendent context. /// Importantly, this function propagates the `has_recursive_ancestor` flag. fn new_descendent_from_ctx(&self, ctx: Self) -> Self { + let ancestor = self; + let mut ctx = ctx; - ctx.has_recursive_ancestor |= self.has_recursive_ancestor; + ctx.has_recursive_ancestor |= ancestor.has_recursive_ancestor; ctx }