Google BigQuery - Updating a nested repeated field

后端 未结 2 560
误落风尘
误落风尘 2020-12-20 06:46

I am trying to update the hits.page.pagePath field in the Google Analytics export in BigQuery, however i\'m unable to unnest the field using the method outlined in the docum

2条回答
  •  抹茶落季
    2020-12-20 07:07

    This should help get you started. You need to include everything else from hits in order to perform the update, including the nested page.

    UPDATE `you_dataset.tablename`
    SET hits = ARRAY(
      SELECT AS STRUCT * REPLACE (
        (SELECT AS STRUCT page.* REPLACE ('foo' AS pagePath)) AS page
      )
      FROM UNNEST(hits) as pagePath
    )
    WHERE fullVisitorID like "%1%"
    

提交回复
热议问题