merge
for filters
Merge the input with a record or table, overwriting values in matching columns.
Signature
> merge {flags} (value)
Parameters
value
: The new value to merge with.
Input/output types:
input | output |
---|---|
record | record |
table | table |
Examples
Add an 'id' column to the input table
> [a b c] | wrap name | merge ( [47 512 618] | wrap id )
╭───┬──────┬─────╮
│ # │ name │ id │
├───┼──────┼─────┤
│ 0 │ a │ 47 │
│ 1 │ b │ 512 │
│ 2 │ c │ 618 │
╰───┴──────┴─────╯
Merge two records
> {a: 1, b: 2} | merge {c: 3}
╭───┬───╮
│ a │ 1 │
│ b │ 2 │
│ c │ 3 │
╰───┴───╯
Merge two tables, overwriting overlapping columns
> [{columnA: A0 columnB: B0}] | merge [{columnA: 'A0*'}]
╭───┬─────────┬─────────╮
│ # │ columnA │ columnB │
├───┼─────────┼─────────┤
│ 0 │ A0* │ B0 │
╰───┴─────────┴─────────╯
Notes
You may provide a column structure to merge
When merging tables, row 0 of the input table is overwritten with values from row 0 of the provided table, then repeating this process with row 1, and so on.