使用 Bigquery 删除具有 "REPEATED" 模式的嵌套列

Using Bigquery remove the nested columns which has "REPEATED" mode

我试图使用 Bigquery 删除嵌套架构,如下所示,但无法这样做。谁能告诉我。如何实现?

Table:

FiledName          Type       Mode
Person            RECORD   REPEATED
Person.Name       STRING   NULLABLE
Person.Add        RECORD   NULLABLE
Person.Add.line   STRING   NULLABLE

代码:

create table `project_id.dataset.new_table_name` as 
select * replace(
   (select as ARRAY(struct person.* except(add))) as person
)
from `project_id.dataset.table_name`;

预期输出:

FiledName          Type       Mode
Person            RECORD   REPEATED
Person.Name       STRING   NULLABLE

试试这个

create table `project_id.dataset.new_table_name` as 
SELECT 
      [STRUCT (P.NAME AS NAME)] AS PERSON

from `project_id.dataset.table_name`,UNNEST(PERSON) AS P;

考虑以下方法

create table `project_id.dataset.new_table_name` as 
select * replace(
    array(select as struct person.* except(add) from t.person) as person
  )
from `project_id.dataset.table_name` t;