Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Debug for ExecutionProps and VarProvider #5489

Merged
merged 3 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions datafusion/core/src/test/variable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::variable::VarProvider;
use arrow::datatypes::DataType;

/// System variable
#[derive(Default)]
#[derive(Default, Debug)]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shows an example of user code that must be changed

pub struct SystemVar {}

impl SystemVar {
Expand All @@ -46,7 +46,7 @@ impl VarProvider for SystemVar {
}

/// user defined variable
#[derive(Default)]
#[derive(Default, Debug)]
pub struct UserDefinedVar {}

impl UserDefinedVar {
Expand Down
12 changes: 11 additions & 1 deletion datafusion/physical-expr/src/execution_props.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Utc>,
/// Providers for scalar variables
Expand Down Expand Up @@ -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:?}"));
}
}
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/var_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>) -> Result<ScalarValue>;

Expand Down