简体   繁体   中英

update/dropping external table in Hive

I'm working on Hive (tables) and I have some problem with updating and dropping external table. I created 2 external tables : T1 and T2 with same attributes

create external table T1(
nom string,
prenom string,
age int);

With query :

insert overwrite table T2( 
select
nom,
prenom,
age from T1;

I can update T2 with data in T1, but doing :

drop table T2;

and then recreating it create external table T2..... I get automatically all present in T2 before dropping, while I would to have an empty table. Is it "normal". Anybody could explain to me, why? and/or recommandate some method?

thx.

Dropping the table would not have removed the data present in the HDFS. The files will be available in the folder

/user/hive/warehouse/dbname.db/tablename

Try creating the table second time by removing the data from HDFS or with some other location specified in the create query itself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM