博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[hive] hive 内部表和外部表
阅读量:2217 次
发布时间:2019-05-08

本文共 1395 字,大约阅读时间需要 4 分钟。

1.内部表

hive (test1)> create table com_inner_person(id int,name string,age int,ctime timestamp) row format delimited fields terminated by ',';OKTime taken: 0.233 secondshive (test1)> load data local inpath '/opt/hadoop/person.data' into table com_inner_person;Loading data to table test1.com_inner_personTable test1.com_inner_person stats: [numFiles=1, totalSize=142]OKTime taken: 0.602 secondshive (test1)> select * from com_inner_person;OK1       王思琪  12      NULL2       张三    13      NULL3       王丽    43      NULL4       三四    23      NULL5       Python  12      NULLTime taken: 0.075 seconds, Fetched: 5 row(s)

 

 

删除表后,数据也一起删除。 

 

2.外部表

hive (test1)> create external table com_ext_person (id int,name string,age int,ctime timestamp) row format delimited fields terminated by ',' location '/opt/hadoop/external';OKTime taken: 0.205 secondshive (test1)> load data local inpath '/opt/hadoop/person.data' into table com_ext_person;Loading data to table test1.com_ext_personTable test1.com_ext_person stats: [numFiles=0, totalSize=0]OKTime taken: 0.512 secondshive (test1)> select * from com_ext_person;OK1       王思琪  12      NULL2       张三    13      NULL3       王丽    43      NULL4       三四    23      NULL5       Python  12      NULL6       spark   32      NULLTime taken: 0.086 seconds, Fetched: 6 row(s)

 

 在指定的location中查看hdfs数据

删除表后,数据仍在。

 

 

转载于:https://www.cnblogs.com/lonelywolfmoutain/p/6929830.html

你可能感兴趣的文章
【操作系统】大小端问题
查看>>
Git上传代码时碰到的问题及解决方法
查看>>
【Linux】vim的简单配置
查看>>
【C++】智能指针
查看>>
【C++】const修饰的成员函数
查看>>
【C++】面向对象的三大特性
查看>>
【C++】智能指针(后续)
查看>>
【C】堆区和栈区的区别
查看>>
【linux】send和recv函数解析
查看>>
【Linux】线程安全的单例模式以及计算密集型线程和IO密集型线程
查看>>
一次完整的HTTP请求是怎样的??
查看>>
【C++】常见的内存泄漏及解决方法
查看>>
【C++】const 指针与指向const的指针
查看>>
【Linux】多线程和多进程 及其应用场景
查看>>
【C++】构造函数中必须通过初始化列表来进行初始化情况
查看>>
【算法】对于大数的操作
查看>>
【操作系统】系统调用的概念
查看>>
【计算机网络】cookie和session的区别
查看>>
【C++】构造函数、析构函数抛出异常的问题
查看>>
【C++】关于vector<bool>
查看>>