Skip to main content

GraphPlanLowerer

Struct GraphPlanLowerer 

Source
pub struct GraphPlanLowerer<'a> { /* private fields */ }
Expand description

Converts a GraphPlan operator pipeline into a DataFusion LogicalPlan.

Construct via GraphPlanLowerer::new and call either lower_plan (processes the full pipeline) or lower_op (processes a single operator given an existing input plan).

Implementations§

Source§

impl<'a> GraphPlanLowerer<'a>

Source

pub fn new( catalog: Option<&'a GraphCatalog>, ontology: Option<&'a OntologyHandle>, ) -> Self

Create a new lowerer for read/query plans.

  • catalog: the GraphCatalog used by scan operators, or None when no catalog is available (scan ops will return an error).
  • ontology: the compiled ontology, or None in exploratory mode.

Lowering a CREATE plan with this constructor errors — use new_for_writes instead.

Source

pub fn new_for_writes( catalog: Option<&'a GraphCatalog>, ontology: Option<&'a OntologyHandle>, dir: &'a Path, mode: OntologyMode, ) -> Self

Create a lowerer that can lower CREATE plans, given the project directory and ontology mode the write should target.

This is the only constructor that authorizes the write path. The same directory is also exposed read-side, so read operators that need it (variable-length Expand) work in mixed read/write pipelines.

Source

pub fn new_with_dir( catalog: Option<&'a GraphCatalog>, ontology: Option<&'a OntologyHandle>, dir: &'a Path, mode: OntologyMode, ) -> Self

Create a read/query lowerer that also knows the project directory.

Required for queries containing variable-length Expand, whose physical node reads edges directly from dir. Equivalent to new for all other read operators. Unlike [new_for_writes], this does not authorize the write path — CREATE still errors.

Source

pub fn lower_plan(&self, plan: &GraphPlan) -> Result<LogicalPlan, GfError>

Lower a complete GraphPlan to a DataFusion LogicalPlan.

Processes the operator pipeline in order. Scan operators (NodeScan, TypedEdgeScan, Expand) are not yet implemented (#576) and return GfError::NotImplemented.

The starting base for the pipeline is an EmptyRelation (zero rows, no columns). #576 will replace this with a real table scan.

§Errors

Returns GfError if any operator in the pipeline cannot be lowered.

Source

pub fn lower_prefix( &self, ops: &[GraphOp], exprs: &ExprArena, var_map: &mut VarMap, ) -> Result<LogicalPlan, GfError>

Lower a statement’s read prefix (ops), exposing the VarMap the write phases resolve identity columns and value expressions against.

Identical to lower_plan except the caller owns the map. An empty ops lowers to the implicit one-row unit relation (the standalone-CREATE prefix).

§Errors

Returns GfError::Plan if any prefix operator cannot be lowered.

Source

pub fn lower_terminal_suffix( &self, ops: &[GraphOp], exprs: &ExprArena, var_map: &mut VarMap, input_schema: DFSchemaRef, ) -> Result<LogicalPlan, GfError>

Lower a terminal read suffix over an already-materialized input schema. The returned plan has a synthetic empty leaf that the executor replaces with the statement driver’s final frontier.

Source

pub fn lower_write_segment( &self, ops: &[GraphOp], exprs: &ExprArena, var_map: &mut VarMap, input_schema: DFSchemaRef, pending_nodes: &RecordBatch, ) -> Result<LogicalPlan, GfError>

Lower a statement-local relational segment with buffered node topology visible alongside persisted nodes.

Source

pub fn resolve_create_pattern( &self, pattern: &CreatePattern, exprs: &ExprArena, var_map: &VarMap, input_schema: &DFSchemaRef, ) -> Result<(Vec<ResolvedNodeSpec>, Vec<ResolvedEdgeSpec>), GfError>

Resolve a CREATE pattern to its executable node/edge specs (label and relation names resolved, property maps evaluated to literals).

The same resolution lower_create bakes into a GraphCreateNode; exposed so the statement driver can run the create phase without a logical plan node.

§Errors

Returns GfError::Plan when a property map cannot be evaluated.

Source

pub fn register_created_node_shapes(&self, nodes: &[ResolvedNodeSpec])

Register freshly-created node shapes in the write driver so a terminal RETURN n can materialize a same-statement created node value.

Source

pub fn register_node_property_shape(&self, var: VarId, name: &str)

Extend a bound node’s same-statement value shape after a dynamic write.

Source

pub fn lower_value_expr( &self, exprs: &ExprArena, var_map: &VarMap, id: ExprId, ) -> Result<DfExpr, GfError>

Lower one IR value expression against var_map (the driver’s frontier registrations, including variables created earlier in the statement).

§Errors

Returns GfError::Plan when the expression cannot be lowered.

Source

pub fn lower_value_expr_with_input( &self, exprs: &ExprArena, var_map: &VarMap, id: ExprId, input_schema: DFSchemaRef, ) -> Result<DfExpr, GfError>

Lower one IR value expression against var_map and an existing input schema. The write driver uses this for a terminal read suffix over its materialized frontier, where temporal/map accessors need the frontier’s Arrow types (#814).

§Errors

Returns GfError::Plan when the expression cannot be lowered.

Source

pub fn entity_name_map(&self) -> HashMap<u32, String>

The TypeId.0 → entity name map (from the ontology), for per-row property-file stem resolution in the statement driver.

Source

pub fn lower_op( &self, op: &GraphOp, input: LogicalPlan, exprs: &ExprArena, _var_map: &VarMap, expr_lowerer: &ExprLowerer<'_>, ) -> Result<LogicalPlan, LoweringError>

Lower a single GraphOp given an input plan (convenience wrapper).

Scan operators (NodeScan, TypedEdgeScan, EdgeScan) ignore input and produce a fresh plan. All other operators fold on top of input.

§Errors

Returns LoweringError if the operator cannot be lowered. Lower a single relational GraphOp given an input plan.

This method handles non-scan operators only. Scan operators (NodeScan, TypedEdgeScan, EdgeScan, Expand) are handled by lower_op_with_arena which manages VarMap mutation separately.

§Errors

Returns LoweringError if the operator cannot be lowered.

Auto Trait Implementations§

§

impl<'a> !Freeze for GraphPlanLowerer<'a>

§

impl<'a> !RefUnwindSafe for GraphPlanLowerer<'a>

§

impl<'a> !UnwindSafe for GraphPlanLowerer<'a>

§

impl<'a> Send for GraphPlanLowerer<'a>

§

impl<'a> Sync for GraphPlanLowerer<'a>

§

impl<'a> Unpin for GraphPlanLowerer<'a>

§

impl<'a> UnsafeUnpin for GraphPlanLowerer<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V