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.
Note on Clone semantics: the derived Clone would alias the
warnings Arc<Mutex<…>>, making warnings collected on the clone
bleed into the original. A clone is intended to be a “fresh executor
borrowing shared state,” so the manual impl below installs a fresh
warnings accumulator. All other Arc-shared state is intentionally
shared (caches, registries, runtimes).
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 set_prop_manager(&mut self, pm: Arc<PropertyManager>)
pub fn set_prop_manager(&mut self, pm: Arc<PropertyManager>)
Install a shared PropertyManager so the planner can reuse it
instead of constructing a fresh one per query.
Reusing the caller’s Arc<PropertyManager> skips the LRU cache
allocation cost (~80 µs/query in the InMemory backend).
Sourcepub fn set_df_session_template(&mut self, tmpl: Arc<SessionContext>)
pub fn set_df_session_template(&mut self, tmpl: Arc<SessionContext>)
Install a pre-built SessionContext template with Cypher UDFs already
registered, so the planner can clone it (O(1)) instead of rebuilding.
When custom UDFs are also installed, the template is bypassed and a
fresh SessionContext is built for that query (preserves UDF
isolation across executors).
Sourcepub fn new_with_writer(
storage: Arc<StorageManager>,
writer: Arc<Writer>,
) -> Self
pub fn new_with_writer( storage: Arc<StorageManager>, writer: Arc<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<Writer>)
pub fn set_writer(&mut self, writer: Arc<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_read_snapshot(&mut self, snapshot: Option<SnapshotView>)
pub fn set_read_snapshot(&mut self, snapshot: Option<SnapshotView>)
Attach a pinned L0 snapshot for snapshot-isolated reads (Component C1).
When Some, get_context reads from the frozen view instead of
the live L0. A None is a no-op (live reads), so threading it is always
safe — callers that do not pin a snapshot leave it None.
Sourcepub fn set_id_reservoir(&mut self, r: Arc<TxIdReservoir>)
pub fn set_id_reservoir(&mut self, r: Arc<TxIdReservoir>)
Attach a per-transaction VID/EID reservoir. When set, CREATE/MERGE
paths in execute_create_pattern pull IDs from the reservoir’s
pre-reserved cache, amortizing the global IdAllocator mutex.
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§
Source§impl Clone for Executor
impl Clone for Executor
Source§fn clone(&self) -> Self
fn clone(&self) -> Self
Clone an Executor, sharing all Arc-backed state but installing a
fresh warnings accumulator. Warnings are query-scoped; aliasing
the Mutex across clones would let one query’s warnings spill into
another.
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for Executor
impl !UnwindSafe for Executor
impl Freeze for Executor
impl Send for Executor
impl Sync for Executor
impl Unpin for Executor
impl UnsafeUnpin for Executor
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSend for Twhere
T: Send,
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.Source§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.impl<T> PluginState for T
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,
impl<T> Read<Exclusive, BecauseExclusive> 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.