Skip to content
Advertisement

How to remove duplicated rows from table with arrays in BigQuery

there is a table in BigQuery that has REPEATED type columns and has duplicated rows, since the table has arrays I cannot use distinct to grab only one row.

Table looks something like this:

image1

I want to remove the duplicated rows, the output should be like this:

image2

I didn’t find a way to come up with the above result, anyone can help?

Advertisement

Answer

Consider below approach

select *
from your_table t
where true
qualify 1 = row_number() over(partition by format('%t', t))
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement