当我查询两级嵌套字段时,我错过了一些行。
架构是这样的:
Productid STRING REQUIRED
Variants RECORD REPEATED
Variants.SKU STRING NULLABLE
Variants.Size STRING NULLABLE
Variants.Prices RECORD REPEATED
Variants.Prices.Country STRING NULLABLE
Variants.Prices.Currency STRING NULLABLE
一些 Variants.Price 记录为空。
当我用这个查询查询这个表时:
select Productid,Variants.SKU,Variants.Size
from ga-export-0000.feed.feed_dev
,UNNEST (Variants) AS Variants
我得到的行比这个多得多:
select Productid,Variants.SKU,Variants.Size
,Prices.Currency,Prices.Country
from ga-export-0000.feed.feed_dev
,UNNEST (Variants) AS Variants
,UNNEST(Variants.Prices) as Prices
这是因为它不会返回缺少 Variants.Prices 的行。
如何修改我的第二个查询,使其返回所有行,如果 Variants.Prices 丢失,它显示为 NULL?