ClickHouseBuilder

Struct ClickHouseBuilder 

Source
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

Source

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.

Source

pub fn new_with_pool_builder( endpoint: impl Into<Destination>, pool_builder: ArrowConnectionPoolBuilder, ) -> Self

Source

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.

Source

pub fn configure_client( self, f: impl FnOnce(ClientBuilder) -> ClientBuilder, ) -> Self

Configure the underlying clickhouse_arrow::ClientBuilder.

Source

pub fn configure_pool( self, f: impl FnOnce(ArrowPoolBuilder) -> ArrowPoolBuilder, ) -> Self

Configure the underlying clickhouse_arrow::ArrowPoolBuilder.

Source

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.

See: clickhouse_arrow::ArrowOptions

Source

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 ClickHouse endpoint is unreachable
  • Returns an error if the ClickHouse catalog fails to be created

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,