#[cfg(feature = "mimalloc")]
use mimalloc::MiMalloc;
use pyo3::prelude::*;
pub use datafusion;
pub use datafusion_common;
pub use datafusion_expr;
pub use datafusion_optimizer;
pub use datafusion_sql;
pub use datafusion_substrait;
#[allow(clippy::borrow_deref_ref)]
pub mod catalog;
pub mod common;
#[allow(clippy::borrow_deref_ref)]
mod config;
#[allow(clippy::borrow_deref_ref)]
mod context;
#[allow(clippy::borrow_deref_ref)]
mod dataframe;
mod dataset;
mod dataset_exec;
pub mod errors;
#[allow(clippy::borrow_deref_ref)]
pub mod expr;
#[allow(clippy::borrow_deref_ref)]
mod functions;
pub mod physical_plan;
mod pyarrow_filter_expression;
mod record_batch;
pub mod sql;
pub mod store;
pub mod substrait;
#[allow(clippy::borrow_deref_ref)]
mod udaf;
#[allow(clippy::borrow_deref_ref)]
mod udf;
pub mod utils;
#[cfg(feature = "mimalloc")]
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
#[pyclass]
pub(crate) struct TokioRuntime(tokio::runtime::Runtime);
#[pymodule]
fn _internal(py: Python, m: &PyModule) -> PyResult<()> {
m.add(
"runtime",
TokioRuntime(tokio::runtime::Runtime::new().unwrap()),
)?;
m.add_class::<catalog::PyCatalog>()?;
m.add_class::<catalog::PyDatabase>()?;
m.add_class::<catalog::PyTable>()?;
m.add_class::<context::PyRuntimeConfig>()?;
m.add_class::<context::PySessionConfig>()?;
m.add_class::<context::PySessionContext>()?;
m.add_class::<dataframe::PyDataFrame>()?;
m.add_class::<udf::PyScalarUDF>()?;
m.add_class::<udaf::PyAggregateUDF>()?;
m.add_class::<config::PyConfig>()?;
m.add_class::<sql::logical::PyLogicalPlan>()?;
m.add_class::<physical_plan::PyExecutionPlan>()?;
let common = PyModule::new(py, "common")?;
common::init_module(common)?;
m.add_submodule(common)?;
let expr = PyModule::new(py, "expr")?;
expr::init_module(expr)?;
m.add_submodule(expr)?;
let funcs = PyModule::new(py, "functions")?;
functions::init_module(funcs)?;
m.add_submodule(funcs)?;
let store = PyModule::new(py, "object_store")?;
store::init_module(store)?;
m.add_submodule(store)?;
let substrait = PyModule::new(py, "substrait")?;
substrait::init_module(substrait)?;
m.add_submodule(substrait)?;
Ok(())
}