Hive常用命令总结
来源:互联网 发布:linux就该这么学百度云 编辑:程序博客网 时间:2024/04/29 16:07
1.建表
#建表(默认是内部表)create table trade_detail(id bigint, account string, income double, expenses double, time string) row format delimited fields terminated by '\t';#建分区表#普通表和分区表区别:有大量数据增加的需要建分区表create table td_part(id bigint, account string, income double, expenses double, time string) partitioned by (logdate string) row format delimited fields terminated by '\t';#建外部表create external table td_ext(id bigint, account string, income double, expenses double, time string) row format delimited fields terminated by '\t' location '/td_ext';
2.加载数据到表
#把本地数据装载到数据表,也就是在metastore上创建信息load data local inpath '/root/a.txt' into table trade_detail; #把HDFS上的数据装载到数据表load data inpath '/target.txt' into table trade_detail;#加载数据到分区表必须指明所属分区load data local inpath './book.txt' overwrite into table book partition (pubdate='2010-08-22');
在Hive shell下执行hadoop命令行:#比如:hadoop fs -ls /,在hive下可以这样执行:hive> dfs -ls /;在Hive shell下执行linux系统命令:!cmd;例如:!pwd;打印当前工作目录在Hive shell下执行sql文件:hive> source my.sql;hive -S 以静默模式启动hive(不打印日志信息,纸打印结果);hive -e "HiveQL",不进入hive的交互模式,直接执行命令;当然也可以结合静默模式一起使用:hive -S -e "HiveQL"
4.另外一些常用的命令其实就是SQL:
#描述表结构desc tablename;#查看创建表信息show create table tablename;#查看表的分区show partitions tablename;
1 0
- Hive常用命令总结
- hive常用命令总结
- hive 常用命令
- hive 常用命令
- hive常用命令
- Hive 常用命令
- Hive常用命令
- hive常用命令
- hive 常用命令
- Hive常用命令
- Hive - 常用命令
- hive 常用命令
- hive常用命令
- Hive常用命令
- hive常用命令
- hive常用命令
- Hive常用命令
- hive常用命令
- 问题链接:UVA10976 Fractions Again?
- [319]Bulb Switcher
- 《数据库系统概论》学习总结
- 2. JMeter中非常重要的几个概念
- URAL - 1748 The Most Complex Number(数论+搜索)
- Hive常用命令总结
- python 国际化一词多义翻译
- Lightoj1211——Intersection of Cubes(立方体的交)
- DataTable
- Sqlite
- js模态框插件
- 深度优先搜索
- volatile的作用和菱形继承问题
- SpringMVC与Struts2区别与比较总结