diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 18b90943fe82..0b9ff3a46ba8 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,18 +6,21 @@ We generally require a GitHub issue to be filed for all bug fixes and enhancemen Closes #. - # Rationale for this change +# Rationale for this change + # What changes are included in this PR? + # Are there any user-facing changes? + diff --git a/datafusion/expr/src/logical_plan/display.rs b/datafusion/expr/src/logical_plan/display.rs index 757d130d481c..2fcd033e19d0 100644 --- a/datafusion/expr/src/logical_plan/display.rs +++ b/datafusion/expr/src/logical_plan/display.rs @@ -48,7 +48,7 @@ impl<'a, 'b> IndentVisitor<'a, 'b> { impl<'a, 'b> PlanVisitor for IndentVisitor<'a, 'b> { type Error = fmt::Error; - fn pre_visit(&mut self, plan: &LogicalPlan) -> std::result::Result { + fn pre_visit(&mut self, plan: &LogicalPlan) -> Result { if self.indent > 0 { writeln!(self.f)?; } @@ -66,10 +66,7 @@ impl<'a, 'b> PlanVisitor for IndentVisitor<'a, 'b> { Ok(true) } - fn post_visit( - &mut self, - _plan: &LogicalPlan, - ) -> std::result::Result { + fn post_visit(&mut self, _plan: &LogicalPlan) -> Result { self.indent -= 1; Ok(true) } @@ -190,7 +187,7 @@ impl<'a, 'b> GraphvizVisitor<'a, 'b> { impl<'a, 'b> PlanVisitor for GraphvizVisitor<'a, 'b> { type Error = fmt::Error; - fn pre_visit(&mut self, plan: &LogicalPlan) -> std::result::Result { + fn pre_visit(&mut self, plan: &LogicalPlan) -> Result { let id = self.graphviz_builder.next_id(); // Create a new graph node for `plan` such as @@ -226,10 +223,7 @@ impl<'a, 'b> PlanVisitor for GraphvizVisitor<'a, 'b> { Ok(true) } - fn post_visit( - &mut self, - _plan: &LogicalPlan, - ) -> std::result::Result { + fn post_visit(&mut self, _plan: &LogicalPlan) -> Result { // always be non-empty as pre_visit always pushes // So it should always be Ok(true) let res = self.parent_ids.pop(); diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs index cb3f7f97df54..284e8c9aa429 100644 --- a/datafusion/expr/src/logical_plan/plan.rs +++ b/datafusion/expr/src/logical_plan/plan.rs @@ -378,17 +378,13 @@ pub trait PlanVisitor { /// visited. If Ok(true) is returned, the recursion continues. If /// Err(..) or Ok(false) are returned, the recursion stops /// immediately and the error, if any, is returned to `accept` - fn pre_visit(&mut self, plan: &LogicalPlan) - -> std::result::Result; + fn pre_visit(&mut self, plan: &LogicalPlan) -> Result; /// Invoked on a logical plan after all of its child inputs have /// been visited. The return value is handled the same as the /// return value of `pre_visit`. The provided default implementation /// returns `Ok(true)`. - fn post_visit( - &mut self, - _plan: &LogicalPlan, - ) -> std::result::Result { + fn post_visit(&mut self, _plan: &LogicalPlan) -> Result { Ok(true) } } @@ -398,7 +394,7 @@ impl LogicalPlan { /// all nodes were visited, and Ok(false) if any call to /// `pre_visit` or `post_visit` returned Ok(false) and may have /// cut short the recursion - pub fn accept(&self, visitor: &mut V) -> std::result::Result + pub fn accept(&self, visitor: &mut V) -> Result where V: PlanVisitor, { @@ -545,12 +541,12 @@ impl LogicalPlan { /// assert_eq!("Filter: t1.id = Int32(5)\n TableScan: t1", /// display_string); /// ``` - pub fn display_indent(&self) -> impl fmt::Display + '_ { + pub fn display_indent(&self) -> impl Display + '_ { // Boilerplate structure to wrap LogicalPlan with something // that that can be formatted struct Wrapper<'a>(&'a LogicalPlan); - impl<'a> fmt::Display for Wrapper<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + impl<'a> Display for Wrapper<'a> { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { let with_schema = false; let mut visitor = IndentVisitor::new(f, with_schema); match self.0.accept(&mut visitor) { @@ -588,12 +584,12 @@ impl LogicalPlan { /// \n TableScan: t1 [id:Int32]", /// display_string); /// ``` - pub fn display_indent_schema(&self) -> impl fmt::Display + '_ { + pub fn display_indent_schema(&self) -> impl Display + '_ { // Boilerplate structure to wrap LogicalPlan with something // that that can be formatted struct Wrapper<'a>(&'a LogicalPlan); - impl<'a> fmt::Display for Wrapper<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + impl<'a> Display for Wrapper<'a> { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { let with_schema = true; let mut visitor = IndentVisitor::new(f, with_schema); match self.0.accept(&mut visitor) { @@ -634,12 +630,12 @@ impl LogicalPlan { /// dot -Tpdf < /tmp/example.dot > /tmp/example.pdf /// ``` /// - pub fn display_graphviz(&self) -> impl fmt::Display + '_ { + pub fn display_graphviz(&self) -> impl Display + '_ { // Boilerplate structure to wrap LogicalPlan with something // that that can be formatted struct Wrapper<'a>(&'a LogicalPlan); - impl<'a> fmt::Display for Wrapper<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + impl<'a> Display for Wrapper<'a> { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { writeln!( f, "// Begin DataFusion GraphViz Plan (see https://graphviz.org)" @@ -686,12 +682,12 @@ impl LogicalPlan { /// /// assert_eq!("TableScan: t1", display_string); /// ``` - pub fn display(&self) -> impl fmt::Display + '_ { + pub fn display(&self) -> impl Display + '_ { // Boilerplate structure to wrap LogicalPlan with something // that that can be formatted struct Wrapper<'a>(&'a LogicalPlan); - impl<'a> fmt::Display for Wrapper<'a> { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + impl<'a> Display for Wrapper<'a> { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { match self.0 { LogicalPlan::EmptyRelation(_) => write!(f, "EmptyRelation"), LogicalPlan::Values(Values { ref values, .. }) => { @@ -957,8 +953,8 @@ impl LogicalPlan { } } -impl fmt::Debug for LogicalPlan { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +impl Debug for LogicalPlan { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { self.display_indent().fmt(f) } } @@ -1554,8 +1550,8 @@ pub enum PlanType { FinalPhysicalPlan, } -impl fmt::Display for PlanType { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { +impl Display for PlanType { + fn fmt(&self, f: &mut Formatter) -> fmt::Result { match self { PlanType::InitialLogicalPlan => write!(f, "initial_logical_plan"), PlanType::OptimizedLogicalPlan { optimizer_name } => {