pub struct ClickHouseTableProvider { /* private fields */ }Expand description
A custom TableProvider for remove ClickHouse tables.
Implementations§
Source§impl ClickHouseTableProvider
impl ClickHouseTableProvider
Sourcepub async fn try_new(
pool: Arc<ClickHouseConnectionPool>,
table: TableReference,
) -> Result<Self>
pub async fn try_new( pool: Arc<ClickHouseConnectionPool>, table: TableReference, ) -> Result<Self>
Creates a new TableProvider, fetching the schema from ClickHouse if not provided.
§Errors
- Returns an error if the
SQLTablecreation fails.
Sourcepub fn new_with_schema_unchecked(
pool: Arc<ClickHouseConnectionPool>,
table: TableReference,
schema: SchemaRef,
) -> Self
pub fn new_with_schema_unchecked( pool: Arc<ClickHouseConnectionPool>, table: TableReference, schema: SchemaRef, ) -> Self
Creates a new TableProvider with a pre-fetched schema. The underlying SqlTable will not
verify if the table exists nor if the schema is accurate. To catch any errors in these
cases, use try_new.
pub fn with_exprs(self, exprs: Vec<Expr>) -> Self
Sourcepub fn with_coercion(self, coerce: bool) -> Self
pub fn with_coercion(self, coerce: bool) -> Self
Whether to coerce the RecordBatches returned by SQLExecutor::execute using the generated
LogicalPlan’s schema.
pub fn reader(&self) -> &SqlTable
pub fn pool(&self) -> &Arc<ClickHouseConnectionPool>
pub fn coerce_schema(&self) -> bool
Sourcepub fn execute_sql(
&self,
query: &str,
schema: SchemaRef,
) -> Result<SendableRecordBatchStream>
pub fn execute_sql( &self, query: &str, schema: SchemaRef, ) -> Result<SendableRecordBatchStream>
Executes a SQL query and returns a stream of record batches.
This method is exposed so that federation is not required to run sql using this table provider.
§Errors
- Returns an error if the connection pool fails to connect.
- Returns an error if the query execution fails.
Sourcepub fn unique_context(&self) -> String
pub fn unique_context(&self) -> String
Provide the unique context for this table provider.
This method is provided publicly to allow access to whether this provider accesses the same
underlying ClickHouse server as another, without relying on federation.
Trait Implementations§
Source§impl Debug for ClickHouseTableProvider
impl Debug for ClickHouseTableProvider
Source§impl TableProvider for ClickHouseTableProvider
impl TableProvider for ClickHouseTableProvider
Source§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Any so that it can be
downcast to a specific implementation.Source§fn table_type(&self) -> TableType
fn table_type(&self) -> TableType
Source§fn supports_filters_pushdown(
&self,
filters: &[&Expr],
) -> Result<Vec<TableProviderFilterPushDown>>
fn supports_filters_pushdown( &self, filters: &[&Expr], ) -> Result<Vec<TableProviderFilterPushDown>>
Source§fn scan<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 dyn Session,
projection: Option<&'life2 Vec<usize>>,
filters: &'life3 [Expr],
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn scan<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
state: &'life1 dyn Session,
projection: Option<&'life2 Vec<usize>>,
filters: &'life3 [Expr],
limit: Option<usize>,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
ExecutionPlan for scanning the table with optionally
specified projection, filter and limit, described below. Read moreSource§fn insert_into<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
input: Arc<dyn ExecutionPlan>,
insert_op: InsertOp,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn insert_into<'life0, 'life1, 'async_trait>(
&'life0 self,
_state: &'life1 dyn Session,
input: Arc<dyn ExecutionPlan>,
insert_op: InsertOp,
) -> Pin<Box<dyn Future<Output = Result<Arc<dyn ExecutionPlan>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
ExecutionPlan to insert data into this table, if
supported. Read moreSource§fn constraints(&self) -> Option<&Constraints>
fn constraints(&self) -> Option<&Constraints>
Source§fn get_table_definition(&self) -> Option<&str>
fn get_table_definition(&self) -> Option<&str>
Source§fn get_logical_plan(&self) -> Option<Cow<'_, LogicalPlan>>
fn get_logical_plan(&self) -> Option<Cow<'_, LogicalPlan>>
LogicalPlan of this table, if available.Source§fn get_column_default(&self, _column: &str) -> Option<&Expr>
fn get_column_default(&self, _column: &str) -> Option<&Expr>
Source§fn statistics(&self) -> Option<Statistics>
fn statistics(&self) -> Option<Statistics>
Auto Trait Implementations§
impl Freeze for ClickHouseTableProvider
impl !RefUnwindSafe for ClickHouseTableProvider
impl Send for ClickHouseTableProvider
impl Sync for ClickHouseTableProvider
impl Unpin for ClickHouseTableProvider
impl !UnwindSafe for ClickHouseTableProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more