Skip to main content

Crate oxisql_datafusion

Crate oxisql_datafusion 

Source
Expand description

oxisql-datafusion — Apache DataFusion TableProvider over an OxiSQL Connection.

This crate exposes oxisql-backed tables to Apache DataFusion so that OLAP SQL queries can be planned and executed against oxisql data using the full DataFusion query engine.

§Quick start

use std::sync::Arc;
use arrow::datatypes::{DataType, Field, Schema};
use oxisql_core::{Row, Value};
use oxisql_datafusion::OxiSqlTableProvider;

let schema = Arc::new(Schema::new(vec![
    Field::new("id",    DataType::Int64,   false),
    Field::new("name",  DataType::Utf8,    false),
    Field::new("score", DataType::Float64, false),
]));

let rows = vec![
    Row::new(
        vec!["id".into(), "name".into(), "score".into()],
        vec![Value::I64(1), Value::Text("Alice".into()), Value::F64(95.5)],
    ),
];

let provider = OxiSqlTableProvider::from_rows(rows, schema);

Re-exports§

pub use context::register_embedded_table;
pub use context::register_oxisql_table;
pub use context::OxiSqlContext;
pub use error::OxiSqlFusionError;
pub use provider::OxiSqlTableProvider;
pub use stream::OxiSqlStreamProvider;
pub use stream::SortOrder;

Modules§

context
OxiSqlContext — a DataFusion SessionContext wrapper pre-configured for OxiSQL backends.
error
Error type for the oxisql-datafusion crate.
provider
OxiSqlTableProvider: a DataFusion TableProvider backed by a snapshot of oxisql_core::Rows held in memory.
stream
Live-streaming DataFusion table provider backed by a real OxiSQL connection.
types
Mapping from oxisql_core::Value / oxisql_core::Row to Apache Arrow types.