Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform 参数类型数组中的运算符没有匹配的签名<;字符串>;_Google Cloud Platform_Google Bigquery - Fatal编程技术网

Google cloud platform 参数类型数组中的运算符没有匹配的签名<;字符串>;

Google cloud platform 参数类型数组中的运算符没有匹配的签名<;字符串>;,google-cloud-platform,google-bigquery,Google Cloud Platform,Google Bigquery,我想使用“WHERE xxx IN('aaa','bbb')执行以下标准SQL 但出现了错误。 是否可以在标准SQL中使用“IN” 标准SQL SELECT commit, author.name, committer.name, committer.time_sec, committer.tz_offset, committer.date.seconds , subject, message, repo_name FROM `bigquery-public-data.github_repos.

我想使用“WHERE xxx IN('aaa','bbb')执行以下标准SQL

但出现了错误。 是否可以在标准SQL中使用“IN”

标准SQL

SELECT commit, author.name, committer.name, committer.time_sec,
committer.tz_offset, committer.date.seconds , subject, message,
repo_name
FROM `bigquery-public-data.github_repos.commits`
WHERE repo_name IN 
('tensorflow/tensorflow', 'facebook/react')
错误


在标准SQL中,您不可能真正做到这一点。但在这篇文章中,他们解释得很好

这就是你如何得到你想要的结果,我认为:

SELECT commit, author.name as author_name, committer.name as committer_name, committer.time_sec,
committer.tz_offset, committer.date.seconds , subject, message,
repo_name
FROM `bigquery-public-data.github_repos.commits`
CROSS JOIN UNNEST(repo_name) as repo_names_unnested
WHERE repo_names_unnested IN ('tensorflow/tensorflow', 'facebook/react')
请注意,您不能同时拥有
author.name
committer.name
,因为两者都将显示为
name
。因此,我将它们改为
作者名
提交人名


我还认为您实际上正在寻找的是用
repo\u names\u unnested
替换
repo\u name
的结果,所以请尝试在SELECT子句中也替换它。

字段“repo\u name”重复(遗留SQL)或数组(标准SQL),这在运算符中不支持标准SQL。要将一个数组转换成一组行,您可以使用我的方法。

下面是BigQuery标准SQL

如果您需要保留原始记录,只需在repo_名称中输出带有“tensorflow/tensorflow”、“facebook/react”的记录:

#standardSQL
SELECT commit, author.name AS author_name, committer.name AS committer_name, committer.time_sec,
committer.tz_offset, committer.date.seconds , subject, message,
repo_name
FROM `bigquery-public-data.github_repos.commits`
WHERE EXISTS (
  SELECT 1 FROM UNNEST(repo_name) name WHERE name IN ('tensorflow/tensorflow', 'facebook/react') 
)

非常感谢你。我已经按照您的建议,将select子句中未列出的回购名称替换为回购名称。太棒了@yukiotakai!如果它有效,请将我的答案标记为正确答案:)谢谢您的日常支持。每次,我都有很多东西要向你学习。此外,我还感谢stack over flow和GCP支持团队!
SELECT commit, author.name as author_name, committer.name as committer_name, committer.time_sec,
committer.tz_offset, committer.date.seconds , subject, message,
repo_name
FROM `bigquery-public-data.github_repos.commits`
CROSS JOIN UNNEST(repo_name) as repo_names_unnested
WHERE repo_names_unnested IN ('tensorflow/tensorflow', 'facebook/react')
#standardSQL
SELECT commit, author.name AS author_name, committer.name AS committer_name, committer.time_sec,
committer.tz_offset, committer.date.seconds , subject, message,
repo_name
FROM `bigquery-public-data.github_repos.commits`
WHERE EXISTS (
  SELECT 1 FROM UNNEST(repo_name) name WHERE name IN ('tensorflow/tensorflow', 'facebook/react') 
)