This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git
The following commit(s) were added to refs/heads/main by this push:
new d47f7fb00f Require `Debug` for `DataSource` (#14882)
d47f7fb00f is described below
commit d47f7fb00f8ce175885ce6a59b8361f4ef8a93e1
Author: Andrew Lamb <[email protected]>
AuthorDate: Wed Feb 26 17:38:59 2025 -0500
Require `Debug` for `DataSource` (#14882)
* Require `Debug` for `DataSource`
* Add a note about why having Debug is useful
---
datafusion/datasource/src/memory.rs | 2 +-
datafusion/datasource/src/source.rs | 10 +++-------
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/datafusion/datasource/src/memory.rs
b/datafusion/datasource/src/memory.rs
index 182ffebdf4..516226d568 100644
--- a/datafusion/datasource/src/memory.rs
+++ b/datafusion/datasource/src/memory.rs
@@ -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>>,
diff --git a/datafusion/datasource/src/source.rs
b/datafusion/datasource/src/source.rs
index 1b0d769029..40df75856e 100644
--- a/datafusion/datasource/src/source.rs
+++ b/datafusion/datasource/src/source.rs
@@ -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 {
fn open(
&self,
partition: usize,
@@ -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 {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]