From 02a19a70607ae8f70cbcbf515107659bf71c3605 Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Mon, 6 Mar 2023 13:10:17 -0500 Subject: [PATCH 1/3] Implement `Debug` for `ExecutionProps` --- datafusion/physical-expr/src/execution_props.rs | 12 +++++++++++- datafusion/physical-expr/src/var_provider.rs | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/datafusion/physical-expr/src/execution_props.rs b/datafusion/physical-expr/src/execution_props.rs index d9f53dbd64d0..02ba1b400271 100644 --- a/datafusion/physical-expr/src/execution_props.rs +++ b/datafusion/physical-expr/src/execution_props.rs @@ -29,7 +29,7 @@ use std::sync::Arc; /// done so during predicate pruning and expression simplification /// /// [`LogicalPlan`]: datafusion_expr::LogicalPlan -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct ExecutionProps { pub query_execution_start_time: DateTime, /// Providers for scalar variables @@ -85,3 +85,13 @@ impl ExecutionProps { .and_then(|var_providers| var_providers.get(&var_type).map(Arc::clone)) } } + +#[cfg(test)] +mod test { + use super::*; + #[test] + fn debug() { + let props = ExecutionProps::new(); + assert_eq!("foo", format!("{props:?}")); + } +} diff --git a/datafusion/physical-expr/src/var_provider.rs b/datafusion/physical-expr/src/var_provider.rs index 0afff91fc694..faa07665e4f3 100644 --- a/datafusion/physical-expr/src/var_provider.rs +++ b/datafusion/physical-expr/src/var_provider.rs @@ -30,7 +30,7 @@ pub enum VarType { } /// A var provider for @variable -pub trait VarProvider { +pub trait VarProvider: std::fmt::Debug { /// Get variable value fn get_value(&self, var_names: Vec) -> Result; From 40d70963015f23d34b240d38bb23e4df370fe4dc Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Mon, 6 Mar 2023 13:16:51 -0500 Subject: [PATCH 2/3] fix examples --- datafusion/core/src/test/variable.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/datafusion/core/src/test/variable.rs b/datafusion/core/src/test/variable.rs index 36431dfd49de..a55513841561 100644 --- a/datafusion/core/src/test/variable.rs +++ b/datafusion/core/src/test/variable.rs @@ -23,7 +23,7 @@ use crate::variable::VarProvider; use arrow::datatypes::DataType; /// System variable -#[derive(Default)] +#[derive(Default, Debug)] pub struct SystemVar {} impl SystemVar { @@ -46,7 +46,7 @@ impl VarProvider for SystemVar { } /// user defined variable -#[derive(Default)] +#[derive(Default, Debug)] pub struct UserDefinedVar {} impl UserDefinedVar { From 20cf518bde05f0e89552971784a8d970489af7fc Mon Sep 17 00:00:00 2001 From: Andrew Lamb Date: Mon, 6 Mar 2023 13:19:39 -0500 Subject: [PATCH 3/3] fix test --- datafusion/physical-expr/src/execution_props.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/datafusion/physical-expr/src/execution_props.rs b/datafusion/physical-expr/src/execution_props.rs index 02ba1b400271..ff413be36141 100644 --- a/datafusion/physical-expr/src/execution_props.rs +++ b/datafusion/physical-expr/src/execution_props.rs @@ -92,6 +92,6 @@ mod test { #[test] fn debug() { let props = ExecutionProps::new(); - assert_eq!("foo", format!("{props:?}")); + assert_eq!("ExecutionProps { query_execution_start_time: 1970-01-01T00:00:00Z, var_providers: None }", format!("{props:?}")); } }