为什么查询对示例提交有效,但对公共github\u repos数据集中的提交无效?

为什么查询对示例提交有效,但对公共github\u repos数据集中的提交无效?,github,google-bigquery,Github,Google Bigquery,我遇到了谷歌BigQuery的一些奇怪行为。数据集bigquery public data.github\u repos提供了表commits和sample\u commits。表的模式应该是相同的,不同之处只是表的大小,因此可以在不浪费有限数据的情况下开发查询 当我对样本数据运行下面的查询时,我得到了10次提交的正确结果: SELECT commit AS commit, repo_name AS repo_name, committer.date AS date FROM

我遇到了谷歌BigQuery的一些奇怪行为。数据集
bigquery public data.github\u repos
提供了表
commits
sample\u commits
。表的模式应该是相同的,不同之处只是表的大小,因此可以在不浪费有限数据的情况下开发查询

当我对样本数据运行下面的查询时,我得到了10次提交的正确结果:

SELECT 
  commit AS commit, 
  repo_name AS repo_name,
  committer.date AS date
FROM 
  `bigquery-public-data.github_repos.sample_commits`
WHERE 
  repo_name = "torvalds/linux"
LIMIT 10
奇怪的是,当我在大表
commits
上运行查询时,我收到一条错误消息:

SELECT 
  commit AS commit, 
  repo_name AS repo_name,
  committer.date AS date
FROM 
  `bigquery-public-data.github_repos.commits`
WHERE 
  repo_name = "torvalds/linux"
LIMIT 10
我收到的错误消息是:

参数类型:数组、字符串的运算符=没有匹配的签名。支持的签名:ANY=anyat[8:3]


从schema表中我还知道,
repo\u name
STRING
类型,所以这个错误让我很困惑

字段
repo\u name
bigquery public data.github\u repos.sample\u committes
表中为字符串可空数据类型

bigquery public data.github\u repos.commits
表中的同一字段为字符串重复数据类型

试试下面

SELECT 
  commit AS commit, 
  repo_name AS repo_name,
  committer.date AS DATE
FROM 
  `bigquery-public-data.github_repos.commits`
WHERE 
  'torvalds/linux' IN UNNEST(repo_name)
LIMIT 10

“表的模式应该相同”可能不是一个好的假设。如果查看
sample\u commits
表的详细信息,可以看到用于从较大的
commits
表生成表的查询。正如米哈伊尔在下面的回答中指出的那样,你可以看到它在
repo_name
上被展平了。谢谢你提供的信息,我没有考虑这个问题。