Can bucketing and partitioning be used in the same query in HIVE ?
Asked
Active
Viewed 281 times
0
-
There is a great way to find out the answer to this question. Run a Hive query that has bucketing and partitioning in it. – o-90 Oct 03 '15 at 20:47
-
Yes. You can have buckets and partition in same HIVE table. and http://stackoverflow.com/questions/19128940/what-is-the-difference-between-partitioning-and-bucketing-a-table-in-hive provide good insight into these concepts. – Ravindra babu Oct 04 '15 at 11:21
1 Answers
0
Yes. Bucketing and partitioning can be applied in the same hive table.
Partitions:
Total number of distinct values on partition column = Total number of folders in HDFS path under table name folder.
To enable, execute:set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;
Buckets:
Total number buckets = no. of files under each partition folder. To enable, execute: set hive.enforce.bucketing = true;

Sandhya
- 31
- 4
-
Please follow proper [formatting](https://stackoverflow.com/help/formatting) guidelines for answering questions on stackoverflow. – Jay Modi Dec 14 '19 at 14:13