transform-tree-flatten only.Expand description
Recursive report-tree / matrix flatten transform (tree_flatten, #530).
Financial-report APIs (QuickBooks / Xero / ZohoBooks / Rillet, and
Sage/Intacct) return a self-referential nested-Rows matrix — a tree of
section → subsection → line, where the tabular output is one row per leaf
carrying the section labels it sits under plus the period columns. Flattening
it is the one reshape that kept those taps on the embedded-DuckDB SQL path;
tree_flatten moves them back to an inbuilt transform.
Pure + recursive: a depth-first walk carrying an ancestor-label stack; at each
leaf it emits { <ancestor columns…>, <header→value columns…>, [path] }. It
routes through TransformStage::Custom (1→0..N),
so no new stage-enum variant is needed (the exhaustive-enum rule).
Structs§
- Ancestors
Spec - Which ancestor labels to carry down onto each emitted row.
- Columns
Spec - How the value columns are read from a leaf node.
- Compiled
Tree Flatten - Validated
TreeFlattenSpec— apply per record withCompiledTreeFlatten::apply. - Tree
Flatten Spec - Spec for the
tree_flattentransform — recursive tree/matrix → leaf rows (1→0..N). Compile withTreeFlattenSpec::compile; attach viaTreeFlattenSpec::into_stage.
Constants§
- DEFAULT_
MAX_ DEPTH - Default
TreeFlattenSpec::max_depth— a stack-overflow backstop for a malformed or cyclic tree, far above any real report nesting.