[英]Can i alter non-Partitioned table with already loaded data to have dynamic partitions?
I have tried with using hive command我尝试使用 hive 命令
insert into table partitioned_table_name partition(partition_col) select * from non-Partitioned table; insert into table partitioned_table_name partition(partition_col) select * 来自非分区表;
Yes, of course you can do it.是的,你当然可以做到。 But you need to select correct sequence of columns while inserting.但是您需要 select 插入时正确的列顺序。 for example, if your table structure is like this -例如,如果您的表结构是这样的 -
create table mytable_patitioned (c1 int, c2 string) partition by c3 int;
Then your insert statement should be like below - partition column should be last column in select statement.那么您的插入语句应该如下所示 - 分区列应该是 select 语句中的最后一列。
insert into mytable_patitioned partition(c3) select c1,c2,c3 from non_part_table;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.