Trait datafusion_expr::TableSource

source ·
pub trait TableSource: Sync + Send {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn schema(&self) -> SchemaRef;

    // Provided methods
    fn constraints(&self) -> Option<&Constraints> { ... }
    fn table_type(&self) -> TableType { ... }
    fn supports_filter_pushdown(
        &self,
        _filter: &Expr,
    ) -> Result<TableProviderFilterPushDown> { ... }
    fn supports_filters_pushdown(
        &self,
        filters: &[&Expr],
    ) -> Result<Vec<TableProviderFilterPushDown>> { ... }
    fn get_logical_plan(&self) -> Option<&LogicalPlan> { ... }
    fn get_column_default(&self, _column: &str) -> Option<&Expr> { ... }
}
Expand description

Access schema information and filter push-down capabilities.

The TableSource trait is used during logical query planning and optimizations and provides a subset of the functionality of the TableProvider trait in the (core) datafusion crate. The TableProvider trait provides additional capabilities needed for physical query execution (such as the ability to perform a scan).

The reason for having two separate traits is to avoid having the logical plan code be dependent on the DataFusion execution engine. Some projects use DataFusion’s logical plans and have their own execution engine.

Required Methods§

source

fn as_any(&self) -> &dyn Any

source

fn schema(&self) -> SchemaRef

Get a reference to the schema for this table

Provided Methods§

source

fn constraints(&self) -> Option<&Constraints>

Get primary key indices, if one exists.

source

fn table_type(&self) -> TableType

Get the type of this table for metadata/catalog purposes.

source

fn supports_filter_pushdown( &self, _filter: &Expr, ) -> Result<TableProviderFilterPushDown>

👎Deprecated since 20.0.0: use supports_filters_pushdown instead

Tests whether the table provider can make use of a filter expression to optimise data retrieval.

source

fn supports_filters_pushdown( &self, filters: &[&Expr], ) -> Result<Vec<TableProviderFilterPushDown>>

Tests whether the table provider can make use of any or all filter expressions to optimise data retrieval.

source

fn get_logical_plan(&self) -> Option<&LogicalPlan>

Get the Logical plan of this table provider, if available.

source

fn get_column_default(&self, _column: &str) -> Option<&Expr>

Get the default value for a column, if available.

Implementors§