pub struct GraphPlan {
pub source: SourceKind,
pub sink: SinkKind,
pub mode: PlanMode,
pub batch_rows: usize,
pub concurrency: usize,
pub checkpoint: String,
pub nodes: Vec<NodePlan>,
pub edges: Vec<EdgePlan>,
pub proposals: Vec<EdgeProposal>,
pub warnings: Vec<String>,
}Expand description
The canonical rel2graph plan: the single source both projections read.
Deterministic by construction (see GraphPlan::from_mapping):
tables schema-then-name, node props ordinal, nodes-before-edges, edges
sorted (from_label, rel, to_label). No timestamps, no randomness, no
hashmap iteration order — the same input is the same bytes, always.
Fields§
§source: SourceKindSource plane.
sink: SinkKindGraph sink.
mode: PlanModeBatch/streaming.
batch_rows: usizeRows per UNWIND … MERGE batch.
concurrency: usizeWriter concurrency (coalesce(N)).
checkpoint: StringThe single checkpoint / storage location.
nodes: Vec<NodePlan>Nodes, in canonical order.
edges: Vec<EdgePlan>Edges, in canonical order.
proposals: Vec<EdgeProposal>T4 inference proposals — emitted commented-out, never applied.
warnings: Vec<String>Provenance + honesty notes, closing every artifact.
Implementations§
Source§impl GraphPlan
impl GraphPlan
Sourcepub fn from_mapping(
spec: &MappingSpec,
opts: &CodegenOptions,
) -> Result<GraphPlan>
pub fn from_mapping( spec: &MappingSpec, opts: &CodegenOptions, ) -> Result<GraphPlan>
Lower a reviewed MappingSpec into the canonical plan.
Walks tables in schema-then-name order; each vertex step becomes a
NodePlan, each edge/fk_edges step a EdgePlan (direction =
src → dst, the child→parent FK direction). custom steps are opaque
and cannot be projected to a declarative graph load, so they are
SURFACED in warnings, never silently dropped.
Errors on the blocking gaps the spec names: a streaming plan on a non-Iceberg source, or a node with no merge key.
Sourcepub fn with_proposals(
self,
proposals: impl IntoIterator<Item = EdgeProposal>,
) -> Self
pub fn with_proposals( self, proposals: impl IntoIterator<Item = EdgeProposal>, ) -> Self
Attach T4 inference proposals (from an inclusion-dependency pass run
elsewhere). They are stamped Tier::T4InclusionDependency and will
only ever be emitted COMMENTED-OUT. Returns self for chaining.
Sourcepub fn contract(&self) -> String
pub fn contract(&self) -> String
A canonical, human-readable digest of the plan’s labels, merge keys, edge directions and batch size — the contract both projections must honour. The two-projections-agree test compares what it can parse back out of each artifact against this. Deterministic and stable.
Sourcepub fn to_pyspark(&self) -> String
pub fn to_pyspark(&self) -> String
Projection (a): a PySpark job loading the schema into the graph
sink. Obeys the rel2graph Python hard rules: a FAIR scheduler, indexes
created at startup, nodes-before-edges, the sink client constructed
inside the partition function, a coalesce() before
foreachPartition, and idempotent UNWIND $rows AS r MERGE in
batch_rows-sized chunks. Streaming wraps the same per-partition writer
in a single foreachBatch with one checkpointLocation.
Deterministic: same plan ⇒ byte-identical Python.
Sourcepub fn emit_warnings(&self, p: &mut String, line_prefix: &str)
pub fn emit_warnings(&self, p: &mut String, line_prefix: &str)
The WARNINGS block, prefixed with line_prefix (e.g. # for Python,
// for RON). Closes every artifact — provenance first, then notes.
Trait Implementations§
impl Eq for GraphPlan
impl StructuralPartialEq for GraphPlan
Auto Trait Implementations§
impl Freeze for GraphPlan
impl RefUnwindSafe for GraphPlan
impl Send for GraphPlan
impl Sync for GraphPlan
impl Unpin for GraphPlan
impl UnsafeUnpin for GraphPlan
impl UnwindSafe for GraphPlan
Blanket Implementations§
impl<T> Allocation for T
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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 more