From your query - it is obvious that you are using BigQuery Legacy SQL
The specifics of output for Legacy SQL is that it is gets flatten
This means that if you have nested rows - they will be flatten
See below example
#legacySQL
SELECT id, NEST(x) AS xs
FROM
(SELECT 1 AS id, 2 AS x),
(SELECT 1 AS id, 3 AS x),
(SELECT 1 AS id, 4 AS x),
(SELECT 2 AS id, 5 AS x),
(SELECT 2 AS id, 6 AS x)
GROUP BY id
It creates two rows as below
Row id xs
1 1 [2,3,4]
2 2 [5,6]
You can check this by running this query with destination table and then preview this table
Now - if you run this same query in Web UI (while in legacy SQL) - you will get 5 rows instead of "expected" 2 rows
Row id xs
1 1 2
2 1 3
3 1 4
4 2 5
5 2 6
Please also note: that flattening happens only on final outer level - subquery do not gets flattened. For example below query will give you count = 2 as you would expect
#legacySQL
SELECT COUNT(1) AS cnt FROM (
SELECT id, NEST(x) AS xs
FROM
(SELECT 1 AS id, 2 AS x),
(SELECT 1 AS id, 3 AS x),
(SELECT 1 AS id, 4 AS x),
(SELECT 2 AS id, 5 AS x),
(SELECT 2 AS id, 6 AS x)
GROUP BY id
)
Row cnt
1 2
So, to address it - I recommend you to migrate to BigQuery Standard SQL
See equivalent example for BigQuery Standard SQL
#standardSQL
WITH `yourTable` AS (
SELECT 1 AS id, [2,3,4] AS xs UNION ALL
SELECT 2, [5,6]
)
SELECT * FROM `yourTable`
with output of just two rows, as one would expected
Row id xs
1 1 2
3
4
2 2 5
6