Hive---外部分区表的创建
2016-07-22 08:59
435 查看
hive> create external table tv2(id int,name string,sex string) partitioned by(day int) > row format delimited > fields terminated by '\t' > location 'hdfs://hadoop11:9000/dir2'; OK Time taken: 0.08 seconds 但是此时表中数据并没有显示,如下: hive> select * from tv2; OK Time taken: 0.06 seconds 原因:没有加入分区 接下来我们加入分区. hive> alter table tv2 add partition(day=22) location 'hdfs://hadoop11:9000/dir2'; OK Time taken: 0.216 seconds 在此查看数据: hive> select * from tv2; OK 1 zhang man 22 2 ming woman 22 3 yang man 22 4 li man 22 5 si woman 22 6 youyou man 22 7 liyou man 22 8 haha woman 22 1 zhang man 22 2 ming woman 22 3 yang man 22 4 li man 22 5 si woman 22 6 youyou man 22 7 liyou man 22 8 haha woman 22 Time taken: 0.176 seconds
后续我是这样操作的:
hive> create external table t4(id int,city string,name string,sex string) > partitioned by(day int) > row format delimited > fields terminated by '\t'; hadoop fs -put word.txt hdfs://ns1/user/dd_edw/zmy_test.db/t2; 指定partition: alter table t4 add partition(day=10) location 'hdfs://ns1/user/dd_edw/zmy_test.db/t4';
相关文章推荐
- ny 216 A problem is easy
- Java 内部类,多线程中Synchronized与wait,notify的使用
- WSO2 集成OA WEBSERVICE测试
- 判断当前系统
- 调色板
- AFNetworking 3.0迁移指南
- Thinking in Java 第17章 容器深入研究(17.10-17.14)
- 连载:面向对象葵花宝典:思想、技巧与实践(11) - “封装” 详解
- NYOJ90整数划分
- C语言变长数组data[0]【总结】
- 软件架构设计---基于鲁棒图进行设计
- 021——hibernateDML操作
- 【Codeforces】-615A-Bulbs(思维,模型:桶)
- 用通俗易懂的大白话讲解Map/Reduce原理
- POJ2262 ZOJ1951 UVa543 Goldbach's Conjecture【哥德巴赫猜想】
- gdb的使用
- js onClick事件传参在字符串中的写法
- 【8】CSS3新增属性
- 8086汇编语言自学经验分享 用debug加载程序后,可以使用u命令查看源代码
- 我经历过最混乱的一个项目