pub struct DataFusionEngine { /* private fields */ }Expand description
DataFusion-backed OLAP engine.
Supports pluggable storage via StorageMode:
InMemory: stores Arrow data in memory, registers asMemTableArrowIpc/Parquet: stores data as files on disk, registers asListingTableS3Parquet/GcsParquet(cloud-storage feature): Parquet files on object storage, registered asListingTableonce the object store is wired into theSessionContext
Implementations§
Source§impl DataFusionEngine
impl DataFusionEngine
Sourcepub fn with_storage(mode: StorageMode) -> Result<Self, DfOlapError>
pub fn with_storage(mode: StorageMode) -> Result<Self, DfOlapError>
Create a new DataFusion engine with the given storage mode.
For file-backed modes, creates the base directory if it doesn’t exist and scans for existing data files to initialize the file counter (avoiding overwrites on restart).
For cloud modes (S3Parquet / GcsParquet, requires the cloud-storage
feature), registers the appropriate object_store implementation with the
DataFusion SessionContext. Credentials are resolved from the environment
at construction time.
Sourcepub fn storage_mode(&self) -> &StorageMode
pub fn storage_mode(&self) -> &StorageMode
Returns the storage mode of this engine.
Trait Implementations§
Source§impl Default for DataFusionEngine
impl Default for DataFusionEngine
Source§impl OlapEngine for DataFusionEngine
impl OlapEngine for DataFusionEngine
Source§type Error = DfOlapError
type Error = DfOlapError
Engine-specific error type returned by all fallible methods.
Source§async fn query(&self, sql: &str) -> Result<Vec<RecordBatch>, Self::Error>
async fn query(&self, sql: &str) -> Result<Vec<RecordBatch>, Self::Error>
Execute an analytical SQL query and return results as Arrow
RecordBatches buffered in memory. Read moreSource§async fn query_stream(
&self,
sql: &str,
) -> Result<RecordBatchBoxStream, Self::Error>
async fn query_stream( &self, sql: &str, ) -> Result<RecordBatchBoxStream, Self::Error>
Execute a SQL query and return a lazy
RecordBatchBoxStream. Read moreSource§async fn execute(&self, sql: &str) -> Result<u64, Self::Error>
async fn execute(&self, sql: &str) -> Result<u64, Self::Error>
Execute a DDL or DML statement without returning rows. Read more
Source§async fn load_arrow(
&self,
table: &str,
batches: &[RecordBatch],
) -> Result<u64, Self::Error>
async fn load_arrow( &self, table: &str, batches: &[RecordBatch], ) -> Result<u64, Self::Error>
Source§async fn create_table(
&self,
table_name: &str,
schema: &SchemaRef,
_primary_key: &[String],
) -> Result<(), Self::Error>
async fn create_table( &self, table_name: &str, schema: &SchemaRef, _primary_key: &[String], ) -> Result<(), Self::Error>
Create a table from an Arrow schema with an optional primary key. Read more
Source§async fn add_column(
&self,
table_name: &str,
column_name: &str,
data_type: &DataType,
) -> Result<(), Self::Error>
async fn add_column( &self, table_name: &str, column_name: &str, data_type: &DataType, ) -> Result<(), Self::Error>
Add a nullable column to an existing table. Read more
Source§async fn drop_column(
&self,
table_name: &str,
column_name: &str,
) -> Result<(), Self::Error>
async fn drop_column( &self, table_name: &str, column_name: &str, ) -> Result<(), Self::Error>
Remove a column from an existing table. Read more
Source§fn supports_transactions(&self) -> bool
fn supports_transactions(&self) -> bool
Auto Trait Implementations§
impl !Freeze for DataFusionEngine
impl !RefUnwindSafe for DataFusionEngine
impl Send for DataFusionEngine
impl Sync for DataFusionEngine
impl Unpin for DataFusionEngine
impl UnsafeUnpin for DataFusionEngine
impl !UnwindSafe for DataFusionEngine
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
Mutably borrows from an owned value. Read more
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>
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 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>
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