#Declare the function once
#standardSQL
CREATE TEMP FUNCTION dedup(val ANY TYPE) AS ((
SELECT ARRAY_AGG(t)
FROM (SELECT DISTINCT * FROM UNNEST(val) v) t
));
SELECT * REPLACE(
dedup(country) AS country,
dedup(product) AS product
)
FROM `project.dataset.table`