Ниже для BigQuery Standard SQL
#standardSQL
CREATE TEMP FUNCTION VLOOKUP(expr ANY TYPE, map ANY TYPE) AS ((
IFNULL((SELECT name FROM UNNEST(map) WHERE id = expr), expr)
));
WITH `project.dataset.table` AS (
SELECT 'aaa' other_fields, [STRUCT('456' AS id_field), STRUCT('3367'), STRUCT('xyz')] AS array_fields UNION ALL
SELECT 'bbb', [STRUCT('56'), STRUCT('89')] UNION ALL
SELECT 'ccc', [STRUCT('40'), STRUCT('768'), STRUCT('8766'), STRUCT('abc')]
), `project.dataset.lookup_table` AS (
SELECT '456' id, 'A' name UNION ALL
SELECT '56', 'B' UNION ALL
SELECT '89', 'C' UNION ALL
SELECT '40', 'D'
)
SELECT t.* REPLACE(
ARRAY(
SELECT AS STRUCT id_field, VLOOKUP(id_field, kv) AS desired_new_field
FROM t.array_fields
) AS array_fields
)
FROM `project.dataset.table` t,
(SELECT ARRAY_AGG(STRUCT(id, name)) AS kv FROM `project.dataset.lookup_table`) arr
с результатом