简体   繁体   English

在Hive中更新/删除外部表

[英]update/dropping external table in Hive

I'm working on Hive (tables) and I have some problem with updating and dropping external table. 我正在使用Hive(表),但在更新和删除外部表时遇到一些问题。 I created 2 external tables : T1 and T2 with same attributes 我创建了2个外部表:具有相同属性的T1和T2

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 : 我可以用T1中的数据更新T2,但可以这样做:

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. 然后重新create external table T2.....它, create external table T2.....在删除之前,我会自动在T2中全部存在,而我将拥有一个空表。 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. 删除表将不会删除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. 尝试通过从HDFS或在create查询本身中指定的其他位置删除数据来第二次创建表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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