Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

How to create partitions on existing Hive table?

Solved Go to solution

How to create partitions on existing Hive table?

New Contributor

I have a table with 38M rows which is being updated daily. The table is in orc format and it is managed table.

I want to create partitions on that table but I couldn't find a way to alter existing non-partitioned table to create partitions in that table.

I tried searching all over the google but the only option I was able to find was Create a new partitioned table and insert data into it from the old table.

I was wondering if there was any way to create partitions on an existing table. My HIVE version is 3.1.


Thanks & Regards,

Kartik

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Re: How to create partitions on existing Hive table?

Yep, create a new one defined the way you want the partitions to be and then insert into that new one using dynamic partitioning and you'll be good to go. Good luck and happy Hadooping.

3 REPLIES 3
Highlighted

Re: How to create partitions on existing Hive table?

Yep, create a new one defined the way you want the partitions to be and then insert into that new one using dynamic partitioning and you'll be good to go. Good luck and happy Hadooping.

Re: How to create partitions on existing Hive table?

New Contributor

Okay. Thanks! But the insertion of data takes too much time for a table with 38M records. Is there any efficient way or trick to do the insertion process faster? @Lester Martin

Re: How to create partitions on existing Hive table?

You could try to do a single INSERT INTO statement per partition and run as many of these simultaneously as your cluster has resources for.