Skip to main content

deltalake_core/kernel/
mod.rs

1//! Delta Kernel module
2//!
3//! The Kernel module contains all the logic for reading and processing the Delta Lake transaction log.
4
5use delta_kernel::engine::arrow_expression::ArrowEvaluationHandler;
6use std::sync::{Arc, LazyLock};
7use tokio::task::JoinHandle;
8use tracing::Span;
9use tracing::dispatcher;
10
11pub mod arrow;
12pub mod error;
13pub mod models;
14pub mod scalars;
15pub mod schema;
16mod snapshot;
17pub mod transaction;
18
19pub use arrow::engine_ext::StructDataExt;
20pub use delta_kernel::engine;
21pub use error::*;
22pub use models::*;
23pub use schema::*;
24pub use snapshot::*;
25
26pub(crate) static ARROW_HANDLER: LazyLock<Arc<ArrowEvaluationHandler>> =
27    LazyLock::new(|| Arc::new(ArrowEvaluationHandler {}));
28
29pub(crate) fn spawn_blocking_with_span<F, R>(f: F) -> JoinHandle<R>
30where
31    F: FnOnce() -> R + Send + 'static,
32    R: Send + 'static,
33{
34    // Capture the current dispatcher and span
35    let dispatch = dispatcher::get_default(|d| d.clone());
36    let span = Span::current();
37
38    tokio::task::spawn_blocking(move || {
39        dispatcher::with_default(&dispatch, || {
40            let _enter = span.enter();
41            f()
42        })
43    })
44}