SQL 无法访问 Big Query 中的字段,类型为 ARRAY<STRUCT<hitNumber INT64,时间 INT64,小时 INT64,...>>
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/39109817/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 04:48:41 来源:igfitidea点击:
Cannot access field in Big Query with type ARRAY<STRUCT<hitNumber INT64, time INT64, hour INT64, ...>>
提问by Feynman27
I'm trying to run a query using Standard SQL Dialect (ie not Legacy SQL) on BigQuery. My query is:
我正在尝试在 BigQuery 上使用标准 SQL 方言(即不是传统 SQL)运行查询。我的查询是:
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?
有人知道正确的语法吗?
回答by Mikhail Berlyant
if you are looking for all referers - try
如果您正在寻找所有推荐人 - 尝试
SELECT date, h.referer
FROM `refresh.ga_sessions_xxxxxx*`, UNNEST(hits) as h