pub struct ClickHouseBuilder { /* private fields */ }Expand description
Entrypoint builder for ClickHouse and DataFusion integration.
Ensures DataFusion default UDFs as well as ClickHouse udfs are registered in
SessionContext, the pool is attached to the ClickHouseTableProviderFactory, and
ClickHouse is reachable by the provided endpoint.
NOTE: While clickhouse_arrow defaults to binary encoding for strings (via
clickhouse_arrow::ArrowOptions::strings_as_strings == false), for DataFusion the
default is true. This can be disabled by modifying the setting via
ClickHouseBuilder::configure_arrow_options
Implementations§
Source§impl ClickHouseBuilder
impl ClickHouseBuilder
Sourcepub fn new(endpoint: impl Into<Destination>) -> Self
pub fn new(endpoint: impl Into<Destination>) -> Self
Create new ClickHouseBuilder that can be used to configure both the
clickhouse_arrow::ClientBuilder, the clickhouse_arrow::ArrowPoolBuilder, and be
“built” into a ClickHouseCatalogBuilder for interacting with ClickHouse databases and
tables.
pub fn new_with_pool_builder( endpoint: impl Into<Destination>, pool_builder: ArrowConnectionPoolBuilder, ) -> Self
Sourcepub fn with_coercion(self, coerce: bool) -> Self
pub fn with_coercion(self, coerce: bool) -> Self
Configure whether to coerce schemas to match expected schemas during query execution.
Remember, there is a non-zero cost incurred per RecordBatch, and this is mainly useful for
allowing looser return types when using clickhouse functions.
Sourcepub fn configure_client(
self,
f: impl FnOnce(ClientBuilder) -> ClientBuilder,
) -> Self
pub fn configure_client( self, f: impl FnOnce(ClientBuilder) -> ClientBuilder, ) -> Self
Configure the underlying clickhouse_arrow::ClientBuilder.
Sourcepub fn configure_pool(
self,
f: impl FnOnce(ArrowPoolBuilder) -> ArrowPoolBuilder,
) -> Self
pub fn configure_pool( self, f: impl FnOnce(ArrowPoolBuilder) -> ArrowPoolBuilder, ) -> Self
Configure the underlying clickhouse_arrow::ArrowPoolBuilder.
Sourcepub fn configure_arrow_options(
self,
f: impl FnOnce(ArrowOptions) -> ArrowOptions,
) -> Self
pub fn configure_arrow_options( self, f: impl FnOnce(ArrowOptions) -> ArrowOptions, ) -> Self
clickhouse_arrow defaults to binary encoding for
datafusion::arrow::datatypes::DataType::Utf8 columns, the default is inverted for
DataFusion. This method allows disabling that change to use binary encoding for strings,
among other configuration options.
Sourcepub async fn build_catalog(
self,
ctx: &SessionContext,
catalog: Option<&str>,
) -> Result<ClickHouseCatalogBuilder>
pub async fn build_catalog( self, ctx: &SessionContext, catalog: Option<&str>, ) -> Result<ClickHouseCatalogBuilder>
Build ensures ClickHouse builtins are registered (such as nested functions), the pool is
attached to the factory, the ClickHouse endpoint is reachable, and the catalog is created
and registered to the SessionContext.
§Errors
- Returns an error if the
ClickHouseendpoint is unreachable - Returns an error if the
ClickHousecatalog fails to be created
Auto Trait Implementations§
impl Freeze for ClickHouseBuilder
impl !RefUnwindSafe for ClickHouseBuilder
impl Send for ClickHouseBuilder
impl Sync for ClickHouseBuilder
impl Unpin for ClickHouseBuilder
impl !UnwindSafe for ClickHouseBuilder
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