pub struct OxideSession { /* private fields */ }Expand description
An OxideLake session.
Implementations§
Source§impl OxideSession
impl OxideSession
Sourcepub fn local() -> Result<OxideSession, EngineError>
pub fn local() -> Result<OxideSession, EngineError>
Creates an embedded session: Parquet pruning on, the local object store registered, the SQL UDFs, and the placement rule targeting the detected backend.
Sourcepub fn local_with_target(
target: BackendKind,
) -> Result<OxideSession, EngineError>
pub fn local_with_target( target: BackendKind, ) -> Result<OxideSession, EngineError>
An embedded session whose placement rule targets target instead of
the detected backend. Placement is a planning decision: operators still
select the real local backend at execute() time and fall back to the
CPU reference, so planning for an absent GPU is safe — it is exactly
what cluster executors do with the scheduler’s plans.
Sourcepub fn local_with_options(
options: &SessionOptions,
) -> Result<OxideSession, EngineError>
pub fn local_with_options( options: &SessionOptions, ) -> Result<OxideSession, EngineError>
An embedded session built with options.
Sourcepub async fn connect(scheduler_url: &str) -> Result<OxideSession, EngineError>
pub async fn connect(scheduler_url: &str) -> Result<OxideSession, EngineError>
Connects to a Ballista scheduler (df://host:port). The session carries
OxideLake’s plan codec so Gpu*Exec nodes survive the trip to executors,
and the SQL UDFs so queries plan client-side; placement itself happens
on the scheduler.
Sourcepub async fn connect_with_options(
scheduler_url: &str,
options: &SessionOptions,
) -> Result<OxideSession, EngineError>
pub async fn connect_with_options( scheduler_url: &str, options: &SessionOptions, ) -> Result<OxideSession, EngineError>
Connects to a Ballista scheduler with options. target is ignored:
on a cluster the scheduler’s OXIDE_CLUSTER_BACKEND decides placement,
so a client-side target would be a knob that quietly does nothing.
Sourcepub fn mode(&self) -> &SessionMode
pub fn mode(&self) -> &SessionMode
The execution mode.
Sourcepub fn ctx(&self) -> &SessionContext
pub fn ctx(&self) -> &SessionContext
The underlying DataFusion context.
Sourcepub fn telemetry(&self) -> &Arc<TelemetryHub> ⓘ
pub fn telemetry(&self) -> &Arc<TelemetryHub> ⓘ
The telemetry hub for this session.
Embedded sessions only. A cluster session’s operators run on
executors, in other processes; this hub is created for the shape of
the type and stays empty, so a snapshot of it is not “no work
happened” but “the work happened somewhere else” (#33). Each worker
reports into its own process-wide hub, which oxide-worker --metrics-port exposes as Prometheus text.
Sourcepub async fn sql(&self, query: &str) -> Result<DataFrame, EngineError>
pub async fn sql(&self, query: &str) -> Result<DataFrame, EngineError>
Plans a SQL statement into a lazily executed DataFrame.
Nothing runs here, so nothing is logged here: see Self::collect
for the one-line-per-query record.
Sourcepub async fn collect(
&self,
query: &str,
) -> Result<(Arc<Schema>, Vec<RecordBatch>), EngineError>
pub async fn collect( &self, query: &str, ) -> Result<(Arc<Schema>, Vec<RecordBatch>), EngineError>
Runs query to completion and logs one INFO line describing it
(#33): the backend it was planned for, the rows it produced, how long
it took, and how many batches fell back to the CPU reference.
This is the line an operator reads to answer “is the GPU being used
and how long did the query take” without attaching a dashboard. It is
on collect rather than on Self::sql because a DataFrame has
not run yet: a line logged at planning time could only report the
plan, and the interesting half is what the plan then did.
The schema comes back beside the batches because an empty result has
no batch to take it from, and a caller rendering CSV still has to
print the header.
Sourcepub async fn register_parquet(
&self,
name: &str,
path: &str,
) -> Result<(), EngineError>
pub async fn register_parquet( &self, name: &str, path: &str, ) -> Result<(), EngineError>
Registers a Parquet file or directory as name.
Trait Implementations§
Source§impl Debug for OxideSession
impl Debug for OxideSession
Source§impl OxideSessionExt for OxideSession
impl OxideSessionExt for OxideSession
Source§async fn read_parquet(&self, path: &str) -> Result<OxideFrame, EngineError>
async fn read_parquet(&self, path: &str) -> Result<OxideFrame, EngineError>
Source§async fn table(&self, name: &str) -> Result<OxideFrame, EngineError>
async fn table(&self, name: &str) -> Result<OxideFrame, EngineError>
Source§async fn sql_frame(&self, query: &str) -> Result<OxideFrame, EngineError>
async fn sql_frame(&self, query: &str) -> Result<OxideFrame, EngineError>
Auto Trait Implementations§
impl !RefUnwindSafe for OxideSession
impl !UnwindSafe for OxideSession
impl Freeze for OxideSession
impl Send for OxideSession
impl Sync for OxideSession
impl Unpin for OxideSession
impl UnsafeUnpin for OxideSession
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request