問題描述
現有表的 Hive 分桶和分區 (Hive bucketing and partition for existing table)
是否可以為已經包含數據的表創建分桶和分區?我在配置單元中有一個超過 100M 記錄的表,我想在表上創建一個分區。我還需要創建分桶。
有可能嗎?
謝謝,巴拉
參考解法
方法 1:
No, it's not possible to alter bucketing and partitioning within a preloaded table, you may have to create a new table with required bucketing and partitioning properties and then load it from the old table.
set hive.enforce.bucketing = true;
FROM old_table insert into table new_bucketed_partitioned_table select * ;
(by Venkadesh Venkat、Aman Mundra)