簡體   English   中英

我可以將已加載數據的非分區表更改為具有動態分區嗎?

[英]Can i alter non-Partitioned table with already loaded data to have dynamic partitions?

我嘗試使用 hive 命令

insert into table partitioned_table_name partition(partition_col) select * 來自非分區表;

是的,你當然可以做到。 但是您需要 select 插入時正確的列順序。 例如,如果您的表結構是這樣的 -

create table mytable_patitioned (c1 int, c2 string) partition by c3 int;

那么您的插入語句應該如下所示 - 分區列應該是 select 語句中的最后一列。

insert into mytable_patitioned partition(c3) select c1,c2,c3 from non_part_table;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM