hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Grover <>
Subject Re: create external table on existing hive partitioned table ?
Date Tue, 19 Jun 2012 20:37:58 GMT
Maybe I don't understand your question properly but creating an external table on a partitioned
table is no different than create an external table on a non-partitioned one.

Your syntax looks right. After table creation, you would have to add all existing partitions
of the table so that the new table's metadata is properly populated.
You can do that using a command like "ALTER TABLE page_access_m RECOVER PARTITIONS" on Amazon
EMR Hive or using msck on Apache Hive (more details at:

Does that answer your question?

On a related note, having two tables over the same data could be troublesome. For example,
if one query adds a partition to one table, you would have to remember to recover partitions
on the on the other table before you access your data through it. If the schema for both the
tables is the same (except the fact that one is managed while other is external), any particular
reason you'd like to create a new table?


----- Original Message -----
From: "Sai Naga" <>
Sent: Tuesday, June 19, 2012 4:19:25 PM
Subject: create external table on existing hive partitioned table ?

Is it possible, to create external table on a existing hive table which is partitioned. 

I have a existing hive table which is partitioned by dt and group like below 

desc page_access; 
page string 
country string 
dt string ( Partitioned column ) 
group string ( Partitioned column ) 

dfs -tail file /user/hive/warehouse/page_access/dt=2012-06-01/group=a/000003_0 

PXXXXX1 {"UY": 2, "BR": 1} 
PXXXXX2 {"LV": 1, "BR": 1} 

Is it possible to define a external table something like.. 

create external table page_access_m 
page string 
country map(<string>,<int>) 
location /user/hive/warehouse/page_access; 

currently I'm using hive.0.6 


View raw message