AsyncCatalogProvider

Trait AsyncCatalogProvider 

Source
pub trait AsyncCatalogProvider: Send + Sync {
    // Required method
    fn schema<'life0, 'life1, 'async_trait>(
        &'life0 self,
        name: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<dyn AsyncSchemaProvider>>, DataFusionError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn resolve<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        references: &'life1 [TableReference],
        config: &'life2 SessionConfig,
        catalog_name: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn CatalogProvider>, DataFusionError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             Self: 'async_trait { ... }
}
Expand description

A trait for catalog providers that must resolve schemas asynchronously

The CatalogProvider::schema method is synchronous because asynchronous operations should not be used during planning. This trait makes it easy to lookup schema references once and cache them for future planning use. See AsyncSchemaProvider for more details on motivation.

Required Methods§

Source

fn schema<'life0, 'life1, 'async_trait>( &'life0 self, name: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Arc<dyn AsyncSchemaProvider>>, DataFusionError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Lookup a schema in the provider

Provided Methods§

Source

fn resolve<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, references: &'life1 [TableReference], config: &'life2 SessionConfig, catalog_name: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<Arc<dyn CatalogProvider>, DataFusionError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, Self: 'async_trait,

Creates a cached provider that can be used to execute a query containing given references

This method will walk through the references and look them up once, creating a cache of schema providers (each with their own cache of table providers). This cache will be returned as a synchronous CatalogProvider that can be used to plan and execute a query containing the given references.

This cache is intended to be short-lived for the execution of a single query. There is no mechanism for refresh or eviction of stale entries.

Implementors§