Skip to content

Require Debug for DataSource #14882

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

Merged
merged 3 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion datafusion/datasource/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ impl MemoryExec {
}

/// Data source configuration for reading in-memory batches of data
#[derive(Clone)]
#[derive(Clone, Debug)]
pub struct MemorySourceConfig {
/// The partitions to query
partitions: Vec<Vec<RecordBatch>>,
Expand Down
10 changes: 3 additions & 7 deletions datafusion/datasource/src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ use datafusion_physical_expr_common::sort_expr::LexOrdering;

/// Common behaviors in Data Sources for both from Files and Memory.
/// See `DataSourceExec` for physical plan implementation
pub trait DataSource: Send + Sync {
///
/// Requires `Debug` to assist debugging
pub trait DataSource: Send + Sync + Debug {
Copy link
Contributor Author

@alamb alamb Feb 25, 2025

Choose a reason for hiding this comment

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

this means that anything that implements DataSource must also implement Debug

This trait was introduced in

And thus has not yet been released yet and thus is not a breaking change

Copy link
Contributor

Choose a reason for hiding this comment

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

probably we can comment why Debug is required? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a note in a5dbaca-- the real reason is to help standard debugging.

fn open(
&self,
partition: usize,
Expand Down Expand Up @@ -66,12 +68,6 @@ pub trait DataSource: Send + Sync {
) -> datafusion_common::Result<Option<Arc<dyn ExecutionPlan>>>;
}

impl Debug for dyn DataSource {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
write!(f, "DataSource: ")
}
}

/// Unified data source for file formats like JSON, CSV, AVRO, ARROW, PARQUET
#[derive(Clone, Debug)]
pub struct DataSourceExec {
Expand Down