#[cfg(feature = "mimalloc")]
use mimalloc::MiMalloc;
use pyo3::prelude::*;
pub use datafusion;
pub use datafusion::common as datafusion_common;
pub use datafusion::logical_expr as datafusion_expr;
pub use datafusion::optimizer;
pub use datafusion::sql as datafusion_sql;
#[cfg(feature = "substrait")]
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)]
pub mod context;
#[allow(clippy::borrow_deref_ref)]
pub 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;
#[cfg(feature = "substrait")]
pub mod substrait;
#[allow(clippy::borrow_deref_ref)]
mod udaf;
#[allow(clippy::borrow_deref_ref)]
mod udf;
mod udwf;
pub mod utils;
#[cfg(feature = "mimalloc")]
#[global_allocator]
static GLOBAL: MiMalloc = MiMalloc;
pub(crate) struct TokioRuntime(tokio::runtime::Runtime);
#[pymodule]
fn _internal(py: Python, m: Bound<'_, PyModule>) -> PyResult<()> {
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::<context::PySQLOptions>()?;
m.add_class::<dataframe::PyDataFrame>()?;
m.add_class::<udf::PyScalarUDF>()?;
m.add_class::<udaf::PyAggregateUDF>()?;
m.add_class::<udwf::PyWindowUDF>()?;
m.add_class::<config::PyConfig>()?;
m.add_class::<sql::logical::PyLogicalPlan>()?;
m.add_class::<physical_plan::PyExecutionPlan>()?;
m.add_class::<record_batch::PyRecordBatch>()?;
m.add_class::<record_batch::PyRecordBatchStream>()?;
let common = PyModule::new_bound(py, "common")?;
common::init_module(&common)?;
m.add_submodule(&common)?;
let expr = PyModule::new_bound(py, "expr")?;
expr::init_module(&expr)?;
m.add_submodule(&expr)?;
let funcs = PyModule::new_bound(py, "functions")?;
functions::init_module(&funcs)?;
m.add_submodule(&funcs)?;
let store = PyModule::new_bound(py, "object_store")?;
store::init_module(&store)?;
m.add_submodule(&store)?;
#[cfg(feature = "substrait")]
setup_substrait_module(py, &m)?;
Ok(())
}
#[cfg(feature = "substrait")]
fn setup_substrait_module(py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
let substrait = PyModule::new_bound(py, "substrait")?;
substrait::init_module(&substrait)?;
m.add_submodule(&substrait)?;
Ok(())
}