我已经使用以下Web UI创建了一个表格:
create table `project.dataset.test3` as (select 123 as id, 456 as offer_id)
我想从以前创建的表中创建一个集群表,所以我尝试:
create table `project.dataset.test4` partition by (fake_date)
cluster by (id, offer_id) as (
SELECT current_timestamp() fake_date, id, offer_id
FROM `project.dataset.test3`
group by 1,2,3)
但是我收到错误消息:
CLUSTER BY expression must be groupable, but type is STRUCT at [2:12]
我搜索了文档,但无法获得对该错误消息的任何了解或解决方法。有什么想法吗?
答案 0 :(得分:1)
在两个或多个逗号分隔的表达式之间加上括号会创建一个结构,并且在您提供的语句中,您具有:
cluster by (id, offer_id)
如果删除括号,则该语句应成功:
cluster by id, offer_id