Here is an example table in BigQuery:
WITH test AS (
SELECT
[
STRUCT("Rudisha" as name, 123 as id),
STRUCT("Murphy" as name, 124 as id),
STRUCT("Bosse" as name, 125 as id),
STRUCT("Rotich" as name, 126 as id)
] AS data
UNION
[
STRUCT("Lewandowski" as name, 127 as id),
STRUCT("Kipketer" as name, 128 as id),
STRUCT("Berian" as name, 129 as id)
] AS data
)
Here I want to extract 'id' fields in the record field ('data') as a repeatable field. So the number of rows will remain the same but only with ids field which is of repeated type:
ids: [123, 124, 125, 126]
ids: [127, 128, 129]
How can I do this?