我在BigQuery中加入时出错

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了我在BigQuery中加入时出错相关的知识,希望对你有一定的参考价值。

我正在尝试将一个表中的数据与其他三个表中的相应匹配字段连接起来。

当我有一个JOIN它工作正常,但添加其他我得到以下错误消息:

在JOIN的任何一侧都找不到字段'dtftv2_sprt_p_match_table_advertisers_166401._PARTITION_LOAD_TIME'

现在我的查询:

SELECT
dtftv2_sprt.sprt_all_clicks.Date as Date,
dtftv2_sprt.p_match_table_advertisers_166401.Advertiser as Advertiser,
dtftv2_sprt.p_match_table_campaigns_166401.Campaigns as Campaign,
dtftv2_sprt.p_match_table_placements_166401.Placements as Placement,
dtftv2_sprt.sprt_all_clicks.Clicks as Clicks

FROM [dtftv2_sprt.sprt_all_clicks]

INNER JOIN [dtftv2_sprt.p_match_table_advertisers_166401] ON 
dtftv2_sprt.sprt_all_clicks.Advertiser_ID = 
dtftv2_sprt.p_match_table_advertisers_166401.Advertiser_ID

INNER JOIN [dtftv2_sprt.p_match_table_campaigns_166401] ON 
dtftv2_sprt.sprt_all_clicks.Campaign_ID = 
dtftv2_sprt.p_match_table_campaigns_166401.Campaign_ID

INNER JOIN [dtftv2_sprt.p_match_table_placements_166401] ON 
dtftv2_sprt.sprt_all_clicks.Placement_ID = 
dtftv2_sprt.p_match_table_placements_166401.Placement_ID

GROUP BY
Date,
Advertiser,
Campaign,
Placement,
Clicks

我没有把_PARTITION_LOAD_TIME链接到任何地方,为什么它会大惊小怪呢? INNER加入正确的使用?

答案

只是尝试将问题限制为连接:也许它与创建/使用的表的分区有关。我不知道系统是否可以在执行查询时需要有关使用哪个分区的信息。但是,我之前没有看到像这样使用的分区。

#standardSQL
SELECT AC.Date as Date,
      TA.Advertiser as Advertiser,
      TC.Campaigns as Campaign,
      TP.Placements as Placement,
      AC.Clicks as Clicks
FROM `dtftv2_sprt.sprt_all_clicks` AC
INNER JOIN `dtftv2_sprt.p_match_table_advertisers_166401` TA 
   ON AC.Advertiser_ID = TA.Advertiser_ID
INNER JOIN `dtftv2_sprt.p_match_table_campaigns_166401` TC 
   ON AC.Campaign_ID = TC.Campaign_ID
INNER JOIN `dtftv2_sprt.p_match_table_placements_166401` TP 
   ON AC.Placement_ID = TP.Placement_ID
GROUP BY Date,
         Advertiser,
         Campaign,
         Placement,
         Clicks

并且可能基于"Error: Field '[REDACTED].field_id' not found on either side of the JOIN", Google BigQuery返回tick而不是[]

另一答案

出于参考目的,这里还有Legacy SQL版本:

SELECT AC.Date as Date, 
       TA.Advertiser as Advertiser,
       TC.Campaign as Campaign,
       TP.Placement as Placement,
       AC.Clicks as Clicks

FROM [dtftv2_sprt.sprt_all_clicks] AC

INNER JOIN [dtftv2_sprt.p_match_table_advertisers_166401] TA 
   ON AC.Advertiser_ID = TA.Advertiser_ID

INNER JOIN [dtftv2_sprt.p_match_table_campaigns_166401] TC 
   ON AC.Campaign_ID = TC.Campaign_ID

INNER JOIN [dtftv2_sprt.p_match_table_placements_166401] TP 
   ON AC.Placement_ID = TP.Placement_ID

GROUP BY Date,
         Advertiser,
         Campaign,
         Placement,
         Clicks

以上是关于我在BigQuery中加入时出错的主要内容,如果未能解决你的问题,请参考以下文章

通过命令行在 BigQuery 中加载数据时出错:已更新

BigQuery 获取外部代码资源的元数据时出错

只有在被选中时才在 ViewPager 中加载片段

NativeGeocoderReverseResult 在 ionic4 + 电容器中导入时出错 [重复]

Sangria-graphql:将 derivedInputObjectType 作为变异参数传入时出错

在 Javascript 中加载 XML 数据时出错