pub struct Executor { /* private fields */ }Expand description
Query executor: runs logical plans against a Uni storage backend.
Executor bridges the logical query plan produced by crate::query::planner::QueryPlanner
with the underlying StorageManager. It handles both read-only sessions and
write-enabled sessions (via Writer and L0Manager).
§Cloning
Executor is cheaply cloneable — all expensive state is held behind Arcs.
Clone it freely to share across tasks.
Implementations§
Source§impl Executor
impl Executor
Sourcepub fn new(storage: Arc<StorageManager>) -> Self
pub fn new(storage: Arc<StorageManager>) -> Self
Create a read-only executor backed by the given storage manager.
Sourcepub fn new_with_writer(
storage: Arc<StorageManager>,
writer: Arc<RwLock<Writer>>,
) -> Self
pub fn new_with_writer( storage: Arc<StorageManager>, writer: Arc<RwLock<Writer>>, ) -> Self
Create a write-enabled executor with an attached Writer.
Sourcepub fn set_procedure_registry(&mut self, registry: Arc<ProcedureRegistry>)
pub fn set_procedure_registry(&mut self, registry: Arc<ProcedureRegistry>)
Attach an external procedure registry for user-defined procedures.
Sourcepub fn set_xervo_runtime(&mut self, runtime: Option<Arc<ModelRuntime>>)
pub fn set_xervo_runtime(&mut self, runtime: Option<Arc<ModelRuntime>>)
Attach or detach the Uni-Xervo model runtime for vector auto-embedding.
Sourcepub fn set_file_sandbox(&mut self, sandbox: FileSandboxConfig)
pub fn set_file_sandbox(&mut self, sandbox: FileSandboxConfig)
Set the file sandbox configuration for BACKUP/COPY/EXPORT commands. MUST be called with sandboxed config in server mode.
Sourcepub fn set_config(&mut self, config: UniConfig)
pub fn set_config(&mut self, config: UniConfig)
Apply a runtime configuration to this executor.
Sourcepub fn set_writer(&mut self, writer: Arc<RwLock<Writer>>)
pub fn set_writer(&mut self, writer: Arc<RwLock<Writer>>)
Attach a Writer after construction, enabling write operations.
Sourcepub fn take_warnings(&self) -> Vec<QueryWarning>
pub fn take_warnings(&self) -> Vec<QueryWarning>
Take all collected warnings from the last execution, leaving the collector empty.
Sourcepub fn set_use_transaction(&mut self, use_transaction: bool)
pub fn set_use_transaction(&mut self, use_transaction: bool)
Configure whether query execution should operate within a transaction context.
Sourcepub fn set_transaction_l0(&mut self, l0: Arc<RwLock<L0Buffer>>)
pub fn set_transaction_l0(&mut self, l0: Arc<RwLock<L0Buffer>>)
Set a private transaction L0 buffer for both read visibility (QueryContext) and mutation routing.
Sourcepub fn set_custom_functions(&mut self, registry: Arc<CustomFunctionRegistry>)
pub fn set_custom_functions(&mut self, registry: Arc<CustomFunctionRegistry>)
Attach a custom scalar function registry for user-defined functions.
Sourcepub fn set_cancellation_token(&mut self, token: CancellationToken)
pub fn set_cancellation_token(&mut self, token: CancellationToken)
Set a cooperative cancellation token for in-flight query cancellation.
Source§impl Executor
impl Executor
Sourcepub async fn create_datafusion_planner(
&self,
prop_manager: &PropertyManager,
params: &HashMap<String, Value>,
) -> Result<(Arc<SyncRwLock<SessionContext>>, HybridPhysicalPlanner, Arc<PropertyManager>)>
pub async fn create_datafusion_planner( &self, prop_manager: &PropertyManager, params: &HashMap<String, Value>, ) -> Result<(Arc<SyncRwLock<SessionContext>>, HybridPhysicalPlanner, Arc<PropertyManager>)>
Create L0 context, session, and planner for DataFusion execution.
This is the shared setup for execute_datafusion and execute_merge_read_plan.
Returns (session_ctx, planner, prop_manager_arc).
Sourcepub fn collect_batches(
session_ctx: &Arc<SyncRwLock<SessionContext>>,
execution_plan: Arc<dyn ExecutionPlan>,
) -> BoxFuture<'_, Result<Vec<RecordBatch>>>
pub fn collect_batches( session_ctx: &Arc<SyncRwLock<SessionContext>>, execution_plan: Arc<dyn ExecutionPlan>, ) -> BoxFuture<'_, Result<Vec<RecordBatch>>>
Execute a DataFusion physical plan and collect all result batches.
Sourcepub async fn execute_datafusion(
&self,
plan: LogicalPlan,
prop_manager: &PropertyManager,
params: &HashMap<String, Value>,
) -> Result<Vec<RecordBatch>>
pub async fn execute_datafusion( &self, plan: LogicalPlan, prop_manager: &PropertyManager, params: &HashMap<String, Value>, ) -> Result<Vec<RecordBatch>>
Executes a query using the DataFusion-based engine.
Uses HybridPhysicalPlanner which produces DataFusion ExecutionPlan
trees with custom graph operators for graph-specific operations.
Sourcepub async fn execute_datafusion_with_plan(
&self,
plan: LogicalPlan,
prop_manager: &PropertyManager,
params: &HashMap<String, Value>,
) -> Result<(Vec<RecordBatch>, Arc<dyn ExecutionPlan>)>
pub async fn execute_datafusion_with_plan( &self, plan: LogicalPlan, prop_manager: &PropertyManager, params: &HashMap<String, Value>, ) -> Result<(Vec<RecordBatch>, Arc<dyn ExecutionPlan>)>
Executes a query using the DataFusion-based engine, returning both result batches and the physical execution plan.
The returned Arc<dyn ExecutionPlan> can be walked to extract per-operator
metrics (e.g., output_rows, elapsed_compute) that DataFusion’s
BaselineMetrics recorded during execution.
pub fn execute<'a>( &'a self, plan: LogicalPlan, prop_manager: &'a PropertyManager, params: &'a HashMap<String, Value>, ) -> BoxFuture<'a, Result<Vec<HashMap<String, Value>>>>
Sourcepub fn execute_stream(
self,
plan: LogicalPlan,
prop_manager: Arc<PropertyManager>,
params: HashMap<String, Value>,
) -> BoxStream<'static, Result<Vec<HashMap<String, Value>>>>
pub fn execute_stream( self, plan: LogicalPlan, prop_manager: Arc<PropertyManager>, params: HashMap<String, Value>, ) -> BoxStream<'static, Result<Vec<HashMap<String, Value>>>>
Executes a query as a stream of result batches.
Routes DDL/Admin through the fallback executor and everything else through DataFusion.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Executor
impl !RefUnwindSafe for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl UnsafeUnpin for Executor
impl !UnwindSafe for Executor
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.