'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'沒有出現,並且不會發生外部鍵的重複。 –