@@ -71,24 +71,33 @@ impl std::fmt::Display for TableType {
7171 }
7272}
7373
74- /// Access schema information and filter push-down capabilities .
74+ /// Planning time information about a table .
7575///
76- /// The TableSource trait is used during logical query planning and
77- /// optimizations and provides a subset of the functionality of the
78- /// `TableProvider` trait in the (core) `datafusion` crate. The `TableProvider`
79- /// trait provides additional capabilities needed for physical query execution
80- /// (such as the ability to perform a scan).
76+ /// This trait is used during logical query planning and optimizations, and
77+ /// provides a subset of the [`TableProvider`] trait, such as schema information
78+ /// and filter push-down capabilities. The [`TableProvider`] trait provides
79+ /// additional information needed for physical query execution, such as the
80+ /// ability to perform a scan or insert data.
81+ ///
82+ /// # See Also:
83+ ///
84+ /// [`DefaultTableSource`] to go from [`TableProvider`], to `TableSource`
85+ ///
86+ /// # Rationale
8187///
8288/// The reason for having two separate traits is to avoid having the logical
8389/// plan code be dependent on the DataFusion execution engine. Some projects use
8490/// DataFusion's logical plans and have their own execution engine.
91+ ///
92+ /// [`TableProvider`]: https://docs.rs/datafusion/latest/datafusion/datasource/provider/trait.TableProvider.html
93+ /// [`DefaultTableSource`]: https://docs.rs/datafusion/latest/datafusion/datasource/default_table_source/struct.DefaultTableSource.html
8594pub trait TableSource : Sync + Send {
8695 fn as_any ( & self ) -> & dyn Any ;
8796
8897 /// Get a reference to the schema for this table
8998 fn schema ( & self ) -> SchemaRef ;
9099
91- /// Get primary key indices, if one exists.
100+ /// Get primary key indices, if any
92101 fn constraints ( & self ) -> Option < & Constraints > {
93102 None
94103 }
@@ -110,6 +119,8 @@ pub trait TableSource: Sync + Send {
110119 }
111120
112121 /// Get the Logical plan of this table provider, if available.
122+ ///
123+ /// For example, a view may have a logical plan, but a CSV file does not.
113124 fn get_logical_plan ( & self ) -> Option < Cow < LogicalPlan > > {
114125 None
115126 }
0 commit comments