BigQuery错误:无法在重复字段上进行分区

wpf*_*abe 7 google-bigquery

我有两个表table1(复杂的表有重复/记录列)和table2(相当简单).我试图创建一个新表与所有列table1与一列table2使用以下查询:

select t1.id, t1.experience.desc, t1.experience.organization.*, t1.experience.department, t2.field2 as t1.experience.organization.newfield, t1.family_name
from [so_public.table1] as t1 left join each [so_public.table2] as t2
on t1.experience.organization.name = t2.field1
Run Code Online (Sandbox Code Playgroud)

我收到错误无法在重复字段上进行分区,如下图所示.两个表的模式也显示在它们各自的图像中.

当一个人想要合并来自两个表的数据时,这里有一般的经验法则吗?我想尽力做什么?

实际的表格要复杂得多.我只展示了足以重现问题的背景.

查询错误 Table1架构 Table2架构

Fel*_*ffa 6

在加入之前,您需要FLATTEN()表.

这不起作用:

SELECT a.fullName, b.fullname
FROM [bigquery-samples:nested.persons_living] a
JOIN [bigquery-samples:nested.persons_living] b
ON a.citiesLived.place=b.citiesLived.place
LIMIT 1000

Error: Cannot join on repeated field citiesLived.place
Run Code Online (Sandbox Code Playgroud)

这样做:

SELECT a.fullName, b.fullname
FROM FLATTEN([bigquery-samples:nested.persons_living], citiesLived) a
JOIN FLATTEN([bigquery-samples:nested.persons_living], citiesLived) b
ON a.citiesLived.place=b.citiesLived.place
LIMIT 1000
Run Code Online (Sandbox Code Playgroud)