【发布时间】:2015-09-27 06:30:51
【问题描述】:
考虑下表(简化版):
id int,
amount decimal,
transaction_no,
location_id int,
created_at datetime
上述架构用于存储餐厅的 POS 收据。现在,此表有时会包含同一日期、同一 transaction_no 在同一 location_id 的收据。
在这种情况下,我想做的是获取该 location_id 和 transaction_no 订单的最后收据created_at desc。
在 MySQL 中,我使用以下查询让我最后一次获得(max(created_at) 收据,用于 location_id 和 transaction_no:
SELECT id, amount, transaction_no, location_id, created_at
FROM receipts r JOIN
(SELECT transaction_no, max(created_at) AS maxca
FROM receipts r
GROUP BY transaction_no
) t
ON r.transaction_no = t.transaction_no AND r.created_at = t.maxca
group by location_id;
但是当我在 BigQuery 中运行相同的程序时,我收到以下错误:
查询失败错误:Shuffle 已达到表 __I0 的广播限制 (至少广播 150393576 字节)。考虑使用分区 加入而不是广播加入。职位编号: 循环要点812:job_A_CfsSKJICuRs07j7LHVbkqcpSg
知道如何在 BigQuery 中使用上述查询吗?
【问题讨论】:
标签: google-bigquery