'hits'是重复记录。 'hits'下的'hits.customDimensions'也是如此。如何查询Google Big Query标准中重复记录中的重复记录SQL
我有这个谷歌大查询在标准SQL:
SELECT
visitNumber,
h.time, h.hour, h.minute,
h.page.PagePath,
h.customDimensions.value as language, /* not working */
from
`550335029.ga_sessions_*` , UNNEST(hits) as h
where
h.customDimensions.index = 3 /* not working */
我正在寻找正确的语法来访问hits.customDimensions.index和hits.customDimensions.value。如果我删除了两个“不工作”的行,查询就会运行。
错误看起来是这样的:
GenericGBQException: Reason: invalidQuery, Message: Cannot access field customDimensions on a value with type ARRAY<STRUCT<hitNumber INT64, time INT64, hour INT64, ...>> at [40:46]
我很想知道UNNEST在这里避免了什么,乍一看它看起来像你在做与上面相同的UNNESTing,只是将其中一个移动到子查询中。 –
如果您在整个数据集上应用UNNEST,那么未占用阵列外的所有密钥都将被复制。通过做我所做的避免,即只有数组'h.customDimension'没有出现,并且不会发生外部键的重复。 –