Okay, it was easier than I thought it would be. One can just use ARRAY in conjunction with UNNEST in the SELECT statement. Basically it looks like this
ARRAY(SELECT transform(x)
FROM UNNEST(array) AS x WITH OFFSET AS y ORDER BY y) AS transformed
So to complete the example from above
WITH
races_with_struct AS (
SELECT
"800M" AS race,
[STRUCT("Rudisha" AS name,
[23.4, 26.3, 26.4, 26.1] AS splits),
STRUCT("Makhloufi" AS name,
[24.5, 25.4, 26.6, 26.1] AS splits),
STRUCT("Lewandowski" AS name,
[25.0, 25.7, 26.3, 27.2] AS splits),
STRUCT("Nathan" AS name,
ARRAY<FLOAT64>[] AS splits),
STRUCT("David" AS name,
NULL AS splits)] AS participants),
races AS (
SELECT
race,
participant.name AS name,
participant.splits AS splits
FROM
races_with_struct r
CROSS JOIN
UNNEST(r.participants) AS participant)
SELECT
race,
name,
splits,
ARRAY(SELECT x + 2
FROM UNNEST(splits) AS x WITH OFFSET AS y ORDER BY y) AS transformed
FROM
races
Answer from p13rr0m on Stack OverflowGoogle
docs.cloud.google.com โบ bigquery โบ array functions
Array functions | BigQuery | Google Cloud Documentation
Returns a concatenation of the elements in array_expression as a STRING or BYTES value. The value for array_expression can either be an array of STRING or BYTES data type. If the null_text parameter is used, the function replaces any NULL values ...
Videos
05:37
Array in Google BigQuery #googlecloud#cloudcomputing#bigquery - ...
ARRAY_AGG in Google BigQuery #education#google#cloud
BigQuery Arrays (Repeated Fields) - YouTube
06:22
Using UNNEST & STRUCT with ARRAYS to create dynamic tables in SQL ...
01:28
How to Apply Functions to All Values in an Array with BigQuery ...
26:08
2 Google BigQuery Array (a.k.a. repeated field) & Struct (a.k.a. ...
How do you create an array from rows in BigQuery?
You can create an array from rows in BigQuery using the ARRAY_AGG() function. This function combines values from multiple rows into a single array.
hevodata.com
hevodata.com โบ home โบ learn โบ bigquery
BigQuery Array Functions and Examples Simplified | Hevo Data
What is the difference between array and STRUCT in BigQuery?
The main difference is that an array stores multiple values of the same type (like
numbers or strings), while a STRUCT can hold different types of data in a single field. An array is like a list, while a STRUCT is like a record containing various fields.
numbers or strings), while a STRUCT can hold different types of data in a single field. An array is like a list, while a STRUCT is like a record containing various fields.
hevodata.com
hevodata.com โบ home โบ learn โบ bigquery
BigQuery Array Functions and Examples Simplified | Hevo Data
Google
docs.cloud.google.com โบ bigquery โบ work with arrays
Work with arrays | BigQuery | Google Cloud Documentation
To learn more about the ARRAY data type, including NULL handling, see Array type. With GoogleSQL, you can construct array literals, build arrays from subqueries using the ARRAY function, and aggregate values into an array using the ARRAY_AGG ...
Count
count.co โบ sql-resources โบ bigquery-standard-sql โบ arrays-explained
Arrays Explained | BigQuery Standard SQL - Count
To filter an ARRAY, we can make use of the ARRAY function:
Top answer 1 of 2
2
Okay, it was easier than I thought it would be. One can just use ARRAY in conjunction with UNNEST in the SELECT statement. Basically it looks like this
ARRAY(SELECT transform(x)
FROM UNNEST(array) AS x WITH OFFSET AS y ORDER BY y) AS transformed
So to complete the example from above
WITH
races_with_struct AS (
SELECT
"800M" AS race,
[STRUCT("Rudisha" AS name,
[23.4, 26.3, 26.4, 26.1] AS splits),
STRUCT("Makhloufi" AS name,
[24.5, 25.4, 26.6, 26.1] AS splits),
STRUCT("Lewandowski" AS name,
[25.0, 25.7, 26.3, 27.2] AS splits),
STRUCT("Nathan" AS name,
ARRAY<FLOAT64>[] AS splits),
STRUCT("David" AS name,
NULL AS splits)] AS participants),
races AS (
SELECT
race,
participant.name AS name,
participant.splits AS splits
FROM
races_with_struct r
CROSS JOIN
UNNEST(r.participants) AS participant)
SELECT
race,
name,
splits,
ARRAY(SELECT x + 2
FROM UNNEST(splits) AS x WITH OFFSET AS y ORDER BY y) AS transformed
FROM
races
2 of 2
0
Consider below approach
SELECT
*,
ARRAY(SELECT '' || split FROM t.splits split) converted_splits,
ARRAY(SELECT 5 + split FROM t.splits split) adjusted_splits
FROM
races t
with output

TutorialsPoint
tutorialspoint.com โบ bigquery โบ bigquery-array-data-type.htm
BigQuery - ARRAY Data Type
The UNNEST() function is used in the FROM clause with a comma. For context: The comma represents an implicit CROSS JOIN. To properly access this ARRAY, use the following query โ
Learn BigQuery!
scosco.github.io โบ learn-bigquery โบ foundation โบ arrays.html
Arrays | Learn BigQuery!
WITH t AS ( SELECT 1 AS id, [1,2,3] AS arr UNION ALL SELECT 2 AS id, [4,5,6] AS arr UNION ALL SELECT 3 AS id, [42] AS arr ) SELECT ARRAY_CONCAT_AGG( arr) as concArr FROM t ยท The aggregation function has some nice features that might come in handy:
Google Cloud
cloud.google.com โบ bigquery โบ array parameters
Array parameters | BigQuery | Google Cloud Documentation
// Run a query using array query parameters // Import the Google Cloud client library const {BigQuery} = require('@google-cloud/bigquery'); const bigquery = new BigQuery(); async function queryParamsArrays() { // The SQL query to run const sqlQuery = `SELECT name, sum(number) as count FROM \`bigquery-public-data.usa_names.usa_1910_2013\` WHERE gender = @gender AND state IN UNNEST(@states) GROUP BY name ORDER BY count DESC LIMIT 10;`; const options = { query: sqlQuery, // Location must match that of the dataset(s) referenced in the query.
Tempered
tempered.works โบ posts โบ 2024 โบ 07 โบ 31 โบ map-over-an-array-in-bigquery
Map over an array in BigQuery - Tempered Works Ltd.
July 31, 2024 - These techniques give me a lot ... I'd use to process ten rows to process ten billion rows in seconds. BigQuery supports array-typed columns but doesn't provide an obvious map or a filter function....