Skip to content

Commit 081e95c

Browse files
onlyjackfrostalamb
andauthored
doc: add diagram to describe how DataSource, FileSource, and DataSourceExec are related (#16181)
* doc: add diagram to describe how DataSource, FileSource, and DataSourceExec are related * update link * format doc * fix ci doc test * update doc * update diagram --------- Co-authored-by: Andrew Lamb <andrew@nerdnetworks.org>
1 parent 7d3c7d8 commit 081e95c

1 file changed

Lines changed: 53 additions & 1 deletion

File tree

datafusion/datasource/src/source.rs

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,60 @@ use datafusion_physical_plan::filter_pushdown::{
5858
/// Requires `Debug` to assist debugging
5959
///
6060
/// [`FileScanConfig`]: https://docs.rs/datafusion/latest/datafusion/datasource/physical_plan/struct.FileScanConfig.html
61-
/// [`MemorySourceConfig`]: https://docs.rs/datafusion/latest//datafusion/datasource/memory/struct.MemorySourceConfig.html
61+
/// [`MemorySourceConfig`]: https://docs.rs/datafusion/latest/datafusion/datasource/memory/struct.MemorySourceConfig.html
6262
/// [`FileSource`]: crate::file::FileSource
63+
/// [`FileFormat``]: https://docs.rs/datafusion/latest/datafusion/datasource/file_format/index.html
64+
/// [`TableProvider`]: https://docs.rs/datafusion/latest/datafusion/catalog/trait.TableProvider.html
65+
///
66+
/// The following diagram shows how DataSource, FileSource, and DataSourceExec are related
67+
/// ```text
68+
/// ┌─────────────────────┐ -----► execute path
69+
/// │ │ ┄┄┄┄┄► init path
70+
/// │ DataSourceExec │
71+
/// │ │
72+
/// └───────▲─────────────┘
73+
/// ┊ │
74+
/// ┊ │
75+
/// ┌──────────▼──────────┐ ┌──────────-──────────┐
76+
/// │ │ | |
77+
/// │ DataSource(trait) │ | TableProvider(trait)|
78+
/// │ │ | |
79+
/// └───────▲─────────────┘ └─────────────────────┘
80+
/// ┊ │ ┊
81+
/// ┌───────────────┿──┴────────────────┐ ┊
82+
/// | ┌┄┄┄┄┄┄┄┄┄┄┄┘ | ┊
83+
/// | ┊ | ┊
84+
/// ┌──────────▼──────────┐ ┌──────────▼──────────┐ ┊
85+
/// │ │ │ │ ┌──────────▼──────────┐
86+
/// │ FileScanConfig │ │ MemorySourceConfig │ | |
87+
/// │ │ │ │ | FileFormat(trait) |
88+
/// └──────────────▲──────┘ └─────────────────────┘ | |
89+
/// │ ┊ └─────────────────────┘
90+
/// │ ┊ ┊
91+
/// │ ┊ ┊
92+
/// ┌──────────▼──────────┐ ┌──────────▼──────────┐
93+
/// │ │ │ ArrowSource │
94+
/// │ FileSource(trait) ◄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄┄│ ... │
95+
/// │ │ │ ParquetSource │
96+
/// └─────────────────────┘ └─────────────────────┘
97+
/// │
98+
/// │
99+
/// │
100+
/// │
101+
/// ┌──────────▼──────────┐
102+
/// │ ArrowSource │
103+
/// │ ... │
104+
/// │ ParquetSource │
105+
/// └─────────────────────┘
106+
/// |
107+
/// FileOpener (called by FileStream)
108+
/// │
109+
/// ┌──────────▼──────────┐
110+
/// │ │
111+
/// │ RecordBatch │
112+
/// │ │
113+
/// └─────────────────────┘
114+
/// ```
63115
pub trait DataSource: Send + Sync + Debug {
64116
fn open(
65117
&self,

0 commit comments

Comments
 (0)