Table Hierarchy Closure
Description
Section titled “Description”The Table: Hierarchy Closure step walks each row up its chain of parents and writes one output row for every row and each of its ancestors. There is no depth limit. The distance column is 0 for the row itself, 1 for its parent, and so on.
A walk stops at a root, at a parent the nodes table doesn’t hold, or at a node it has already met, so a loop in the parent ids can’t run forever. A loop keeps every ancestor up to the repeated node. A loop that no root reaches ends at its smallest id.
Source & Options
Section titled “Source & Options”- Rows to Walk From — the table whose rows start the walks.
- Id column and Parent column — each row’s id and its parent’s id. NULL, or the row’s own id, marks a root.
- Nodes Table (optional) — the table of nodes the walk climbs. Leave blank to use the source table.
- Nodes id column and Nodes parent column (optional) — default to the id and parent columns. An id with several rows follows a root row, else its smallest parent.
- Ancestor column — the output column holding the ancestor id. The default is
Ancestor. - Distance column — the steps from the start row. The default is
Distance. - Strings Built Along the Path (optional) — one row per text column to build up as the walk climbs. Each row has:
- Output Column — the new column.
- Source Column — the column read as text, and Nodes Column to read from the nodes table when it differs.
- Delimiter — the text between values.
- Distinct — skip a value the text already holds.
- Root first — put each ancestor before the text so far.
- Output Table — where the result is written.
The output has the id and parent columns, the ancestor and distance columns, and one text column for each string you build.
Related
Section titled “Related”- Table Multi-Table Join — join the closure back to values
- Migrate Savant Analyses