我有table1
没有分区键,我想创建一个table2
,使用与table1
相同的架构,但设置一列" datestr
& #34;作为分区键。如何编写CREATE TABLE LIKE
查询来执行此操作?
table1:
datestr, userID, transaction, balance
table2 (set datestr as partition key):
datestr, userID, transaction, balance
答案 0 :(得分:0)
CREATE TABLE LIKE
DDL不支持设置分区
我相信你可以像这样执行CTAS查询
Create table table2 (userID INT, transaction STRING, balance DECIMAL)
Partitioned by (datestr STRING)
as
select userID, transaction, balance, datestr
From table1;
当然,相应地添加列类型