In hive, once the table is created with n buckets. Is their any way to increase number of buckets?
Buckets are physical folders so we cant do it easily. You need to recreate the table with new structure. step 1 - create a table with new structure.
CREATE TABLE [db_name.]newtable (...) [CLUSTERED BY (col_name, col_name, ...) INTO num_buckets BUCKETS;
step 2 - reload newtable from original.
insert into newtable select * from mytable;
step 3 - drop original table and rename new table to original.
drop table mytable; alter table newtable rename to mytable;
Buckets are physical folders so we cant do it easily. You need to recreate the table with new structure.
step 1 - create a table with new structure.
step 2 - reload newtable from original.
step 3 - drop original table and rename new table to original.