如果事件类别为eventInfo.EventCategory
,我试图将记录('videoj'
)更新为'video_watched'
。
要测试更新,我创建了'ga_sessions_XXXXXX'
表的副本为'testupdateXXXXXX'
。当我运行以下查询时,得到了意外的结果:
UPDATE `dataset.testupdateXXXXXX` t1
SET t1.hits =
ARRAY(
SELECT AS STRUCT * REPLACE(
(SELECT AS STRUCT eventInfo.* REPLACE('videoj' AS
eventCategory)) AS eventInfo)
FROM t1.hits AS h
WHERE h.eventInfo.eventCategory = 'video_watched' and h.eventInfo.eventAction = 'play')
WHERE EXISTS
( SELECT 1 FROM t1.hits AS h
WHERE h.eventInfo.eventCategory = 'video_watched'
and h.eventInfo.eventAction = 'play')
'video_watched'
类别已正确更新为'videoj'
,但是我希望其他事件类别具有相同的行数。
结果:
Check this screenshot to see the comparison between actual table and updated table records
在BQ中更新STRUCT的文档非常简短。我希望有人可以帮助我理解为什么其他类别显示不同的数字。预先感谢。