Venus
Venus

Reputation: 146

Hive: Multiple files in one partition

Hive: Can I add partition with few locations?

For example, will the following query work?

alter table data 
add partition (year = 2013, month = 11, day = 18) 
LOCATION '/path1/a.avro,/path2/b.avro..'; 

Upvotes: 1

Views: 1271

Answers (1)

Marcin
Marcin

Reputation: 693

Yes, you can. If the partition already exists in Hive (HDFS directory), then you don't need to run any hive alter commands. Just use hadoop -fs put ..

For example you have a hive partition table test (partitioned by dt): /user/hive/warehouse/test/dt=20131216 with files: /user/hive/warehouse/test/dt=20131216/1.avro /user/hive/warehouse/test/dt=20131216/2.avro Now if you have a new avro file: 3.avro then just run the hadoop fs -put command and hive will be able to see the new file automatically.

Upvotes: 1

Related Questions