无法访问大查询中类型为 ARRAY < strucCT < hitNumber INT64,time INT64,hour INT64,... > 的字段

我试图在 BigQuery 上使用标准 SQL 方言(即不是传统 SQL)运行一个查询,我的查询是:

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

但是继续得到错误

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

有人知道正确的语法吗?

116958 次浏览

if you are looking for all referers - try

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