SetDifference / List Layer
Compute the set difference between two variable-length lists (left - right). Returns a list containing elements that exist in the left list but not in the right list. Similar to Python's set difference operation (set(a) - set(b)).
Mathematical definition: For sets A and B, the set difference A \ B (or A - B) is defined as: In other words, elements that are in A but not in B.
Example transformation:
left_list | right_list | difference |
---|---|---|
[1, 2, 3, 4] | [2, 4, 5] | [1, 3] |
[a, b, c] | [b, d] | [a, c] |
[1, 1, 2, 3] | [1, 2] | [3] |
[x, y] | [] | [x, y] |
[] | [1, 2] | [] |
[1, null, 3] | [1, 2] | [3] |
Properties:
- Not commutative:
- Set difference with empty set:
- Empty set difference:
Common applications:
- Finding removed items between versions
- Identifying unique user permissions
- Analyzing set complement operations
- Finding unmatched elements
- Detecting missing features
- Computing relative complements
Note: Duplicates in input lists are removed (set semantics). Null values are ignored. Order of elements in result is not guaranteed. Lists can have different lengths.
SelectLeft
columnThe left list column (SelectLeft
) for set difference. Examples:
- Current features: [f1, f2, f3, f4]
- User permissions: [read, write, admin]
- Product categories: [food, electronics, books] Lists can have different lengths. Duplicates allowed but treated as single elements.
SelectRight
columnThe right list column (SelectRight
) to subtract. Examples:
- Removed features: [f2, f4]
- Revoked permissions: [admin]
- Discontinued categories: [books] Lists can have different lengths. Duplicates allowed but treated as single elements.
AsColumn
nameName for the new column. If not provided, the system generates a unique name. If AsColumn
matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.