External Hive Table Partition


2 Answer(s)


Hi Rakesh,

Here are some sample reference with code examples for Hive External table with partition:

/hadoop-tutorial/apache-hive-tutorial-tables

http://blog.zhengdong.me/2012/02/22/hive-external-table-with-partitions/

Hope this helps.

Thanks.


Hi Rakesh,

Dynamic partition steps remain same for both internal and external tables.
 
Sample queries:

CREATE EXTERNAL TABLE page_view_dynamic_dz(
view_time INT, 
user_id BIGINT,
page_url STRING,
ip STRING COMMENT 'IP Address of the User')
COMMENT 'This is the page view table'
PARTITIONED BY(dt STRING, country STRING)
ROW FORMAT DELIMITED FIELDS TERMINATED BY ',' 
STORED AS TEXTFILE;
 
set hive.exec.dynamic.partition=true;
set hive.exec.dynamic.partition.mode=nonstrict;

 

INSERT OVERWRITE TABLE page_view_dynamic_dz
PARTITION (dt, country)
SELECT view_time,user_id,page_url,ip,dt,country from page_view ;

 

Thanks,
Karan