Skip to content

Commit d47f7fb

Browse files
authored
Require Debug for DataSource (#14882)
* Require `Debug` for `DataSource` * Add a note about why having Debug is useful
1 parent 8d2d495 commit d47f7fb

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

datafusion/datasource/src/memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ impl MemoryExec {
346346
}
347347

348348
/// Data source configuration for reading in-memory batches of data
349-
#[derive(Clone)]
349+
#[derive(Clone, Debug)]
350350
pub struct MemorySourceConfig {
351351
/// The partitions to query
352352
partitions: Vec<Vec<RecordBatch>>,

datafusion/datasource/src/source.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ use datafusion_physical_expr_common::sort_expr::LexOrdering;
3535

3636
/// Common behaviors in Data Sources for both from Files and Memory.
3737
/// See `DataSourceExec` for physical plan implementation
38-
pub trait DataSource: Send + Sync {
38+
///
39+
/// Requires `Debug` to assist debugging
40+
pub trait DataSource: Send + Sync + Debug {
3941
fn open(
4042
&self,
4143
partition: usize,
@@ -66,12 +68,6 @@ pub trait DataSource: Send + Sync {
6668
) -> datafusion_common::Result<Option<Arc<dyn ExecutionPlan>>>;
6769
}
6870

69-
impl Debug for dyn DataSource {
70-
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
71-
write!(f, "DataSource: ")
72-
}
73-
}
74-
7571
/// Unified data source for file formats like JSON, CSV, AVRO, ARROW, PARQUET
7672
#[derive(Clone, Debug)]
7773
pub struct DataSourceExec {

0 commit comments

Comments
 (0)