merge_objects¶
Description¶
Merge one or more objects into a single object.
Values for keys of later arguments overwrite those same keys from earlier arguments. Requires at least one object argument.
Return type¶
object
Domain¶
This is a scalar function (calculates a single output value for a single input row.)
Categories¶
Usage¶
merge_objects(object_1, object_2, ...)
Argument |
Type |
Optional |
Repeatable |
Restrictions |
|---|---|---|---|---|
object |
object |
no |
yes |
none |
Examples¶
make_col obj1:object(parse_json(string1)), obj2:object(parse_json(string2))
make_col obj_merged:merge_objects(obj1, obj2)
drop_col obj1, obj2, string1, string2
First, parses the columns string1 and string2 as JSON objects, storing the results into the columns col1 and col2.
Then, merges obj1 and obj2 into the column obj_merged, giving keys in obj2 precedence over keys with the same name in obj1.
Finally, cleans up the dataset by dropping the intermediate columns.