From 6e2ff2955d96cacba905d24993353c7e5fe0cf93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=9E=97=E4=BC=9F?= Date: Thu, 1 Aug 2024 23:16:05 +0800 Subject: [PATCH] Derive Debug for logical plan nodes (#11757) --- datafusion/expr/src/logical_plan/plan.rs | 40 ++++++++++++------------ 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/datafusion/expr/src/logical_plan/plan.rs b/datafusion/expr/src/logical_plan/plan.rs index 54c857a2b701..6bea1ad948a1 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 row pub 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 query pub 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 schema pub schema: DFSchemaRef, @@ -2023,7 +2023,7 @@ pub fn projection_schema(input: &LogicalPlan, exprs: &[Expr]) -> Result, @@ -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 input pub left: Arc, @@ -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 plan pub input: Arc, @@ -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 merge pub inputs: Vec>, @@ -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 statement pub 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 schema pub schema: Arc, @@ -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 operator pub node: Arc, @@ -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 fetch pub 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 expressions All(Arc), @@ -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 list pub on_expr: Vec, @@ -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 expressions pub expr: Vec, @@ -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 input pub left: Arc,