01 Feb 21 · dan-irving · #bigquery ·   Bookmark   ×

Bigquery - Split Output is Repeated String and therefore ARRAY

When you use SPLIT function in BigQuery, the result is an ARRAY

You need to UNNEST the result of split as shown below to use it:

WITH 
ex1 AS (
SELECT 'test1,test2' as example),

ex2 AS (
SELECT 'test1' as str1, 5 as value)

SELECT * from
(SELECT * FROM UNNEST((SELECT split(example) FROM ex1)) as strings)
left join ex2
on str1 = strings

dan-irving

posted on 01 Feb 21

Enjoy great content like this and a lot more !

Signup for a free account to write a post / comment / upvote posts. Its simple and takes less than 5 seconds