Request a demo

BigQuery · Array function

BigQuery ARRAY_CONCAT

ARRAY_CONCAT(arr1, arr2, ...) joins two or more arrays of the same element type into one, keeping order and duplicates. It returns NULL if any input is NULL, so wrap nullable arrays in IFNULL(arr, []). The || operator does the same.

GoogleSQL for BigQuery · Checked against the official reference in November 2026

ARRAY_CONCAT appends the elements of each argument in order: ARRAY_CONCAT([1, 2], [3]) returns [1, 2, 3]. The || operator is shorthand for the same call ([1, 2] || [3]). To add a single element, wrap it in brackets: ARRAY_CONCAT(tags, ['vip']). Unlike array_cat in PostgreSQL or ARRAY_CAT in Snowflake, it takes any number of arguments.

All arguments must have exactly the same element type. BigQuery doesn't coerce between array types, so ARRAY_CONCAT([1, 2], [2.5]) fails with No matching signature for function ARRAY_CONCAT, even though both are literals. Cast the elements of one side first.

If any argument is NULL, the whole result is NULL, and the console then displays it as an empty array, which makes the bug easy to miss. Guard nullable inputs with IFNULL(arr, []). Arrays read from a table column are never NULL, but arrays from LEFT JOINs, JSON functions or CASE expressions can be.

ARRAY_CONCAT works within one row. To merge arrays across rows, use the aggregate ARRAY_CONCAT_AGG, or unnest and re-aggregate with ARRAY_AGG. Duplicates are kept; for a set union, deduplicate with ARRAY(SELECT DISTINCT ...).

Syntax

ARRAY_CONCAT(array_expression[, ...])

array_expression || array_expression [|| ...]

Arguments and return value

ArgumentDescription
array_expressionArrays with the same element type. Their elements are appended in argument order.

Returns: An ARRAY with the same element type as the inputs. NULL if any argument is NULL.

Examples

Concatenate arrays and append elements

SELECT
  ARRAY_CONCAT(['email', 'sms'], ['push'], ['email']) AS channels,
  [1, 2] || [3] || [4, 5] AS with_operator;
Result
channelswith_operator
[email, sms, push, email][1, 2, 3, 4, 5]

One NULL input makes the whole result NULL

User 2 has a NULL tag array, as it would after a LEFT JOIN. The console would show the NULL result as [], so the query tests it with IS NULL.

WITH users AS (
  SELECT 1 AS user_id, ['beta'] AS tags UNION ALL
  SELECT 2, CAST(NULL AS ARRAY<STRING>)
)
SELECT
  user_id,
  ARRAY_CONCAT(tags, ['newsletter']) IS NULL AS naive_is_null,
  ARRAY_CONCAT(IFNULL(tags, []), ['newsletter']) AS safe
FROM users
ORDER BY user_id;
Result
user_idnaive_is_nullsafe
1false[beta, newsletter]
2true[newsletter]

Merge two channel lists without duplicates

WITH profiles AS (
  SELECT 'u1' AS user_id, ['email', 'sms'] AS crm_channels, ['sms', 'push'] AS app_channels
)
SELECT
  user_id,
  ARRAY(
    SELECT DISTINCT channel
    FROM UNNEST(ARRAY_CONCAT(crm_channels, app_channels)) AS channel
    ORDER BY channel
  ) AS channels
FROM profiles;
Result
user_idchannels
u1[email, push, sms]

Append a tag to stored rows

Stored arrays are never NULL, so no IFNULL is needed. The NOT IN check keeps the tag from being added twice.

UPDATE `project.dataset.customers`
SET tags = ARRAY_CONCAT(tags, ['vip'])
WHERE customer_id = 42
  AND 'vip' NOT IN UNNEST(tags);

Common mistakes

  • Passing an array that can be NULL. ARRAY_CONCAT(NULL_array, ['x']) returns NULL, not ['x']; use IFNULL(arr, []).
  • Mixing element types. ARRAY<INT64> and ARRAY<FLOAT64> don't concatenate, even as literals; cast one side's elements to the other type first.
  • Using ARRAY_CONCAT to combine arrays from different rows. It works within a row; use ARRAY_CONCAT_AGG(arr) with GROUP BY across rows.
  • Expecting a set union. Duplicates stay: ARRAY_CONCAT(['a'], ['a']) returns [a, a].

FAQ

How do I append an element to an array in BigQuery?

Wrap the element in brackets and concatenate: ARRAY_CONCAT(arr, [new_value]) or arr || [new_value]. To prepend, put it first: [new_value] || arr.

How do I concatenate arrays from multiple rows?

Use the aggregate ARRAY_CONCAT_AGG(arr) with GROUP BY. ARRAY_CONCAT only combines arrays that are in the same row.

Why does ARRAY_CONCAT return an empty array?

Usually one input was NULL, which makes the result NULL, and the console displays a NULL array as []. Check with ARRAY_CONCAT(...) IS NULL and wrap the inputs in IFNULL(arr, []).

Errors you may hit

More array functions

All BigQuery array functions · All functions · BigQuery error messages

Observability for every BigQuery table, in about 15 minutes

Masthead detects freshness, volume and schema anomalies, monitors pipeline errors and maps column-level lineage across all your projects, from logs and metadata only.