Cannot access field in Big Query with type ARRAY<STRUCT<hitNumber INT64, time INT64, hour INT64, …>>

半腔热情 提交于 2020-06-09 15:27:07

问题


I'm trying to run a query using Standard SQL Dialect (ie not Legacy SQL) on BigQuery. My query is:

SELECT
date, hits.referer
FROM `refresh.ga_sessions_xxxxxx*`
LIMIT 1000

But keep getting the error

Error: Cannot access field referer on a value with type 
ARRAY<STRUCT<hitNumber INT64, time INT64, hour INT64, ...>> at [2:12]

Anyone know the proper syntax?


回答1:


if you are looking for all referers - try

SELECT date, h.referer
FROM `refresh.ga_sessions_xxxxxx*`, UNNEST(hits) as h


来源:https://stackoverflow.com/questions/39109817/cannot-access-field-in-big-query-with-type-arraystructhitnumber-int64-time-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!