Skip to content

Commit

Permalink
fix doc test and add more doc
Browse files Browse the repository at this point in the history
  • Loading branch information
goldmedal committed Aug 16, 2024
1 parent daa7ed8 commit e4a2174
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
10 changes: 9 additions & 1 deletion datafusion/catalog/src/dynamic_file/catalog.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
// specific language governing permissions and limitations
// under the License.

//! dynamic_file contains a SchemaProvider that creates tables from file paths
//! dynamic_file contains [`DynamicFileCatalog`] that creates tables from file paths
//! if the wrapped [`CatalogProviderList`] doesn't have the table provider.
use crate::{CatalogProvider, CatalogProviderList, SchemaProvider, TableProvider};
use async_trait::async_trait;
Expand All @@ -24,8 +25,11 @@ use dirs::home_dir;
use std::any::Any;
use std::sync::Arc;

/// Wrap another catalog provider list
pub struct DynamicFileCatalog {
/// The inner catalog provider list
inner: Arc<dyn CatalogProviderList>,
/// The factory that can create a table provider from the file path
factory: Arc<dyn UrlTableFactory>,
}

Expand Down Expand Up @@ -67,7 +71,9 @@ impl CatalogProviderList for DynamicFileCatalog {

/// Wraps another catalog provider
struct DynamicFileCatalogProvider {
/// The inner catalog provider
inner: Arc<dyn CatalogProvider>,
/// The factory that can create a table provider from the file path
factory: Arc<dyn UrlTableFactory>,
}

Expand Down Expand Up @@ -112,7 +118,9 @@ impl CatalogProvider for DynamicFileCatalogProvider {
/// The provider will try to create a table provider from the file path if the table provider
/// isn't exist in the inner schema provider. The required object store must be registered in the session context.
pub struct DynamicFileSchemaProvider {
/// The inner schema provider
inner: Arc<dyn SchemaProvider>,
/// The factory that can create a table provider from the file path
factory: Arc<dyn UrlTableFactory>,
}

Expand Down
4 changes: 3 additions & 1 deletion datafusion/core/src/datasource/dynamic_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
// specific language governing permissions and limitations
// under the License.

//! dynamic_file_schema contains a SchemaProvider that creates tables from file paths
//! dynamic_file_schema contains an [`UrlTableFactory`] implementation that
//! can create a [`ListingTable`] from the given url.
use std::sync::Arc;

Expand All @@ -31,6 +32,7 @@ use crate::execution::context::SessionState;
/// [DynamicListTableFactory] is a factory that can create a [ListingTable] from the given url.
#[derive(Default)]
pub struct DynamicListTableFactory {
/// The session store that contains the current session.
session_store: Arc<SessionStore>,
}

Expand Down
4 changes: 2 additions & 2 deletions datafusion/core/src/execution/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ impl SessionContext {
}

/// Enable the dynamic file query for the current session.
/// See [DynamicFileSchemaProvider] for more details
/// See [DynamicFileCatalog] for more details
///
/// # Example: query the url table
///
Expand All @@ -343,7 +343,7 @@ impl SessionContext {
/// assert_batches_eq!(
/// &[
/// "+---+----------------+",
/// "| a | MIN(example.b) |",
/// "| a | min(example.b) |",
/// "+---+----------------+",
/// "| 1 | 2 |",
/// "+---+----------------+",
Expand Down

0 comments on commit e4a2174

Please sign in to comment.