If i have 2 columns with sketches made on the same datatype, can i merge the sketches in both columns to get a final sketch corresponding to each row in the dataset in Google BigQuery?
col1 | col2 | sketchA|sketchB
_______________________________
c1 | c2 |sketch1 | sketch5
c3 | c4 |sketch2 | null
c3 | c5 |sketch3 | null
c3 |c6 |null. |sketch6
c2 |c6 |sketch7 | sketch4
c5 |c9 |null |sketch8
is it possible to merge sketch columns => sketchA, sketchB ? such that the final output is
col1 | col2 | sketchMerge
___________________
c1 | c2 |merge(sketch5, sketch1)
c3 | c4 |sketch2
c3 | c5 |sketch3
c3 |c6 |sketch6
c2 |c6 |merge(sketch7, sketch4)
c5 |c9 |sketch8
Yes, you can. Use below approach (BigQuery Standard SQL)
SELECT *, (
SELECT HLL_COUNT.MERGE_PARTIAL(sketch)
FROM UNNEST([sketchA, sketchB]) sketch
) AS sketchMerge
FROM your_table
If apply to dummy data similar to yours in question - output is