2
votes

Is it possible to create bucketing and partitioning for a table that already contains data? I have a table in hive with more than 100M of records and I want to create a partition on the table. Also I need to create the bucketing.

Is it possible?

Thanks, Bala

1
As partitions and buckets categorize the data , this doesnt take effect on tables containing data , So alter command has no effect. - K S Nidhin
create another table with bucketing and partition and insert the data from this table to the new table - madhu

1 Answers

0
votes

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 * ;