Expand description
Pipeline-level transform stages. A TransformStage wraps one of six
shapes:
TransformStage::Mapholds an unchanged 1→1RecordTransform.TransformStage::Filteris a predicate-based 1→0|1 stage.TransformStage::Explodeexpands an array field into 1→0..N output records.TransformStage::CdcUnwrapnormalizes a CDC change-event envelope ({op, before, after, …}) into a flat row plus a marker field; DDL and truncate events are dropped (1→0|1).TransformStage::Customis anFn(Value) -> Vec<Value>closure escape hatch for library callers.TransformStage::PageFnis aFn(Vec<Value>) -> Result<Vec<Value>, FaucetError>whole-batch closure for transforms that need the full page at once (SQL, sort, dedup, top-N). Not addressable from YAML.
apply_stages_to_page is the page-granular runner: per-record stages
(Map/Filter/Explode/Custom) flat-map over each record in order,
while PageFn stages receive and return the whole page slice. Declared
order is preserved, so filter → sql → select works as expected.
The observability wrapper crate::observability::instrumented_apply_stages
wraps apply_stages_to_page and aggregates per-page metrics.
Structs§
- CdcUnwrap
Spec transform-cdc-unwrap - Spec for
TransformStage::CdcUnwrap. Normalizes a CDC change-event envelope ({op, before, after, …}) into a flat row plus a marker field, so a downstream upsert sink never needs to understand CDC. A 1→0|1 stage: DDL/truncate events (and non-delete events with noafterimage) are dropped. - Compiled
CdcUnwrap transform-cdc-unwrap - Pre-compiled cdc_unwrap.
pubso it can sit inside thepubCompiledStage::CdcUnwrapvariant without triggering theprivate_interfaceslint — same shape as the already-pubCompiledExplodesibling that backsCompiledStage::Explode. - Compiled
Explode transform-explode - Pre-compiled explode: path parsed once, prefix resolved once.
- Compiled
Filter transform-filter - Pre-compiled filter: path parsed once, value cloned once.
- Compiled
Path - Pre-parsed JSONPath. Bad syntax surfaces at
compile_stagetime, not per record. The implementation is a hand-rolled parser for the v1 subset (bare key, dot path, bracketed string key) — sufficient because we need to walk parent-container chains for explode mutation, which thejsonpath_rust::query()API doesn’t expose. - Explode
Spec transform-explode - Spec for
TransformStage::Explode. Fans one record out into N records based on the array atpath. Compiled into aCompiledExplodeat pipeline-build time; per-record work is one path resolve + N clones + N merges. - Filter
Spec transform-filter - Predicate spec for
TransformStage::Filter. Compiled into aCompiledFilterat pipeline-build time; per-record work is a single path resolve + comparison.
Enums§
- Compiled
Stage - Pre-compiled stage. Per-record work is just lookup + comparison + flat-map.
- Filter
Op transform-filter - Comparison operator for
FilterSpec. - OnMissing
transform-explode - Behaviour when an
ExplodeSpec’spathdoesn’t yield a non-empty array. The default isPassthroughbecause silently dropping records is the worst failure mode for ETL pipelines — surfacing the record unchanged lets downstream stages decide. - Path
Segment - Transform
Stage - One stage in a transform pipeline.
Functions§
- apply_
stages - Per-record stage runner. Returns 0..N output records. Pure; no metrics.
- apply_
stages_ to_ page - Page-granular stage runner. Per-record stages (
Map/Filter/Explode/Custom) flat-map over the current page;PageFnstages transform the whole page at once. Preserves declared order, sofilter → sql → selectworks. - compile_
stage - Compile a
TransformStageinto itsCompiledStageform.
Type Aliases§
- Page
FnBox - Type alias for the page-level transform closure stored in
TransformStage::PageFnandCompiledStage::PageFn.