Apache DataFusion SQL Query Engine
Derive Debug for logical plan nodes (#11757)
张林伟6e2ff2955d96
diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rsindex 54c857a2b7..6bea1ad948 100644--- a/datafusion/expr/src/logical_plan/plan.rs+++ b/datafusion/expr/src/logical_plan/plan.rs@@ -1895,7 +1895,7 @@ impl ToStringifiedPlan for LogicalPlan {}/// Produces no rows: An empty relation with an empty schema-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct EmptyRelation {/// Whether to produce a placeholder rowpub produce_one_row: bool,@@ -1925,7 +1925,7 @@ pub struct EmptyRelation {/// intermediate table, then empty the intermediate table.////// [Postgres Docs]: https://www.postgresql.org/docs/current/queries-with.html#QUERIES-WITH-RECURSIVE-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct RecursiveQuery {/// Name of the querypub name: String,@@ -1942,7 +1942,7 @@ pub struct RecursiveQuery {/// Values expression. See/// [Postgres VALUES](https://www.postgresql.org/docs/current/queries-values.html)/// documentation for more details.-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct Values {/// The table schemapub schema: DFSchemaRef,@@ -2023,7 +2023,7 @@ pub fn projection_schema(input: &LogicalPlan, exprs: &[Expr]) -> Result<Arc<DFSc}/// Aliased subquery-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]// mark non_exhaustive to encourage use of try_new/new()#[non_exhaustive]pub struct SubqueryAlias {@@ -2071,7 +2071,7 @@ impl SubqueryAlias {////// Filter should not be created directly but instead use `try_new()`/// and that these fields are only pub to support pattern matching-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]#[non_exhaustive]pub struct Filter {/// The predicate expression, which must have Boolean type.@@ -2174,7 +2174,7 @@ impl Filter {}/// Window its input based on a set of window spec and window function (e.g. SUM or RANK)-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct Window {/// The incoming logical planpub input: Arc<LogicalPlan>,@@ -2368,7 +2368,7 @@ impl TableScan {}/// Apply Cross Join to two logical plans-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct CrossJoin {/// Left inputpub left: Arc<LogicalPlan>,@@ -2379,7 +2379,7 @@ pub struct CrossJoin {}/// Repartition the plan based on a partitioning scheme.-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct Repartition {/// The incoming logical planpub input: Arc<LogicalPlan>,@@ -2388,7 +2388,7 @@ pub struct Repartition {}/// Union multiple inputs-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct Union {/// Inputs to mergepub inputs: Vec<Arc<LogicalPlan>>,@@ -2398,7 +2398,7 @@ pub struct Union {/// Prepare a statement but do not execute it. Prepare statements can have 0 or more/// `Expr::Placeholder` expressions that are filled in during execution-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct Prepare {/// The name of the statementpub name: String,@@ -2430,7 +2430,7 @@ pub struct Prepare {/// | parent_span_id | Utf8 | YES |/// +--------------------+-----------------------------+-------------+/// ```-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct DescribeTable {/// Table schemapub schema: Arc<Schema>,@@ -2440,7 +2440,7 @@ pub struct DescribeTable {/// Produces a relation with string representations of/// various parts of the plan-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct Explain {/// Should extra (detailed, intermediate plans) be included?pub verbose: bool,@@ -2456,7 +2456,7 @@ pub struct Explain {/// Runs the actual plan, and then prints the physical plan with/// with execution metrics.-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct Analyze {/// Should extra detail be included?pub verbose: bool,@@ -2471,7 +2471,7 @@ pub struct Analyze {// the manual `PartialEq` is removed in favor of a derive.// (see `PartialEq` the impl for details.)#[allow(clippy::derived_hash_with_manual_eq)]-#[derive(Clone, Eq, Hash)]+#[derive(Debug, Clone, Eq, Hash)]pub struct Extension {/// The runtime extension operatorpub node: Arc<dyn UserDefinedLogicalNode>,@@ -2487,7 +2487,7 @@ impl PartialEq for Extension {}/// Produces the first `n` tuples from its input and discards the rest.-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct Limit {/// Number of rows to skip before fetchpub skip: usize,@@ -2499,7 +2499,7 @@ pub struct Limit {}/// Removes duplicate rows from the input-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub enum Distinct {/// Plain `DISTINCT` referencing all selection expressionsAll(Arc<LogicalPlan>),@@ -2518,7 +2518,7 @@ impl Distinct {}/// Removes duplicate rows from the input-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct DistinctOn {/// The `DISTINCT ON` clause expression listpub on_expr: Vec<Expr>,@@ -2604,7 +2604,7 @@ impl DistinctOn {/// Aggregates its input based on a set of grouping and aggregate/// expressions (e.g. SUM).-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]// mark non_exhaustive to encourage use of try_new/new()#[non_exhaustive]pub struct Aggregate {@@ -2767,7 +2767,7 @@ fn calc_func_dependencies_for_project(}/// Sorts its input according to a list of sort expressions.-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct Sort {/// The sort expressionspub expr: Vec<Expr>,@@ -2778,7 +2778,7 @@ pub struct Sort {}/// Join two logical plans on one or more join columns-#[derive(Clone, PartialEq, Eq, Hash)]+#[derive(Debug, Clone, PartialEq, Eq, Hash)]pub struct Join {/// Left inputpub left: Arc<LogicalPlan>,