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>
impl<'a> GraphPlanLowerer<'a>
Sourcepub fn new(
catalog: Option<&'a GraphCatalog>,
ontology: Option<&'a OntologyHandle>,
) -> Self
pub fn new( catalog: Option<&'a GraphCatalog>, ontology: Option<&'a OntologyHandle>, ) -> Self
Create a new lowerer for read/query plans.
catalog: theGraphCatalogused by scan operators, orNonewhen no catalog is available (scan ops will return an error).ontology: the compiled ontology, orNonein exploratory mode.
Lowering a CREATE plan with this constructor errors — use
new_for_writes instead.
Sourcepub fn new_for_writes(
catalog: Option<&'a GraphCatalog>,
ontology: Option<&'a OntologyHandle>,
dir: &'a Path,
mode: OntologyMode,
) -> Self
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.
Sourcepub fn new_with_dir(
catalog: Option<&'a GraphCatalog>,
ontology: Option<&'a OntologyHandle>,
dir: &'a Path,
mode: OntologyMode,
) -> Self
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.
Sourcepub fn lower_plan(&self, plan: &GraphPlan) -> Result<LogicalPlan, GfError>
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.
Sourcepub fn lower_prefix(
&self,
ops: &[GraphOp],
exprs: &ExprArena,
var_map: &mut VarMap,
) -> Result<LogicalPlan, GfError>
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.
Sourcepub fn lower_terminal_suffix(
&self,
ops: &[GraphOp],
exprs: &ExprArena,
var_map: &mut VarMap,
input_schema: DFSchemaRef,
) -> Result<LogicalPlan, GfError>
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.
Sourcepub fn lower_write_segment(
&self,
ops: &[GraphOp],
exprs: &ExprArena,
var_map: &mut VarMap,
input_schema: DFSchemaRef,
pending_nodes: &RecordBatch,
) -> Result<LogicalPlan, GfError>
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.
Sourcepub fn resolve_create_pattern(
&self,
pattern: &CreatePattern,
exprs: &ExprArena,
var_map: &VarMap,
input_schema: &DFSchemaRef,
) -> Result<(Vec<ResolvedNodeSpec>, Vec<ResolvedEdgeSpec>), GfError>
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.
Sourcepub fn register_created_node_shapes(&self, nodes: &[ResolvedNodeSpec])
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.
Sourcepub fn register_node_property_shape(&self, var: VarId, name: &str)
pub fn register_node_property_shape(&self, var: VarId, name: &str)
Extend a bound node’s same-statement value shape after a dynamic write.
Sourcepub fn lower_value_expr(
&self,
exprs: &ExprArena,
var_map: &VarMap,
id: ExprId,
) -> Result<DfExpr, GfError>
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.
Sourcepub fn lower_value_expr_with_input(
&self,
exprs: &ExprArena,
var_map: &VarMap,
id: ExprId,
input_schema: DFSchemaRef,
) -> Result<DfExpr, GfError>
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.
Sourcepub fn entity_name_map(&self) -> HashMap<u32, String>
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.
Sourcepub fn lower_op(
&self,
op: &GraphOp,
input: LogicalPlan,
exprs: &ExprArena,
_var_map: &VarMap,
expr_lowerer: &ExprLowerer<'_>,
) -> Result<LogicalPlan, LoweringError>
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> 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> 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 more