How to use 'raw' and array function in the same query?

SELECT   RAW ARRAY_DISTINCT(ARRAY_FLATTEN(ARRAY_AGG(doc.beers[*].name),2))
FROM bucket doc
WHERE doc.type = "brewer";

OR

SELECT RAW ARRAY_DISTINCT(ARRAY_FLATTEN( (SELECT   RAW doc.beers[*].name
                                          FROM bucket doc
                                          WHERE doc.type = "brewer"),2));

OR

SELECT  DISTINCT RAW b.name 
FROM bucket doc
UNNEST doc.beers AS b
WHERE  doc.type = "brewer";
2 Likes