Reshapes
← Relifold documentation

Union

Combine Spaces and collapse rows with the same exact key.

Union materializes several input Spaces into one output Space and merges rows sharing the declared key.

Worked example

Union(
    name="combine-and-deduplicate",
    input_spaces=("web-products", "store-products"),
    output_space="products",
    key="sku",
    merge_policy={"inventory": "sum", "tags": "union"},
)
ParameterDefaultMeaning
input_spacesrequiredThe Space or Spaces read by the reshape.
namerequiredA stable node name shown in the pipeline and session.
output_spacerequiredThe combined output Space.
keyidField or fields used for exact grouping. Every key field must exist in every input Space.
merge_policypreservePer-field rules such as sum, min, max, union, last, or a callable.

Output

One merged row per distinct key.

Design guidance

Union is exact deduplication and group-by aggregation. Use SemCluster only when two different keys may still denote the same semantic value. When later semantic work must preserve every source identity, union the identity-list field explicitly, keep that list out of model evidence, and map the semantic result back afterward.