欢迎投稿

今日深度:

hive 外部表,

hive 外部表,


1.创建 外表                                                  

 hive> create external table bbb (id int,name string) row format delimited fields terminated by '  '  location '/bbb'; 

2.此时表中没有数据,mysql存在此表的meta信息,hdfs上此时有个文件夹就是,bbb表,指定表的位置由location指定。

3. load数据

hive> load data local inpath '/home/a.txt' into table bbb;   

4查询selct * from bbb;是有数据了,此时hdfs目录下的bbb文件夹下会有load进来的a.txt。

5. 删除此表,

      drop table bbb; 执行后此时程序会将mysql中的meta数据删除,show table 没有此表了。

6.此时问题来了,hdfs上的数据依然存在。这就是外表和内表的区别。


www.htsjk.Com true http://www.htsjk.com/hive/39362.html NewsArticle hive 外部表, 1.创建 外表                                                    hive create external table bbb (id int,name string) row format delimited fields terminated by '  '  location '/bbb';  2.此时表...
相关文章
    暂无相关文章
评论暂时关闭