use std::any::Any;
use std::sync::Arc;
use async_trait::async_trait;
use crate::arrow::datatypes::SchemaRef;
use crate::error::Result;
use crate::logical_plan::Expr;
use crate::physical_plan::ExecutionPlan;
#[derive(Debug, Clone, PartialEq)]
pub enum TableProviderFilterPushDown {
Unsupported,
Inexact,
Exact,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum TableType {
Base,
View,
Temporary,
}
#[async_trait]
pub trait TableProvider: Sync + Send {
fn as_any(&self) -> &dyn Any;
fn schema(&self) -> SchemaRef;
fn table_type(&self) -> TableType {
TableType::Base
}
async fn scan(
&self,
projection: &Option<Vec<usize>>,
filters: &[Expr],
limit: Option<usize>,
) -> Result<Arc<dyn ExecutionPlan>>;
fn supports_filter_pushdown(
&self,
_filter: &Expr,
) -> Result<TableProviderFilterPushDown> {
Ok(TableProviderFilterPushDown::Unsupported)
}
}