没有结果或没有结果的扁平化

Flattening with missing or no results

我是 Bigquery 的新手,我想在一个查询中取消嵌套 2 个表。

我尝试查询以下代码,但没有成功。它给了我这条消息:"This query returned no results".

SELECT
    timestamp AS Date,
    A.key,
    B.name
FROM `pms_table_request_log.partners_request_log_*`,
     UNNEST(jsonPayload.response.body.channels) AS A,
     UNNEST(jsonPayload.response.body.data.rows) AS B;

我希望键和名称是未嵌套的。

如果取消嵌套你的意思是 "flatten",这意味着将数组字段中的数据带到顶层,你可以尝试 LEFT JOIN 而不是 CROSS JOIN(逗号)

SELECT timestamp AS Date ,A.key ,B.name 
FROM pms_table_request_log.partners_request_log_* 
  LEFT JOIN UNNEST(jsonPayload.response.body.channels) AS A 
  LEFT JOIN UNNEST(jsonPayload.response.body.data.rows) AS B

如果数组中有任何一个为空,CROSS JOIN 将销毁整行,而 LEFT JOIN 保留左侧 "table"