hive 命令
来源:互联网 发布:java虚拟机apk 编辑:程序博客网 时间:2024/05/16 18:39
创建表
create cite(citing int,cited int) ROW FORMAT DELIMITED FIELDS TERMINATED BY ' '; //此处我本来写的分隔符是/t 但是就是一直null 后来改成' 'ok
导入hdfs数据
load data inpath 'hdfs://master:54310/user/root/cite.txt' overwrite into table cite;
导入本地
oad data local inpath '/usr/local/hadoop/hive/cite.txt' overwrite into table cite;
// 这个是本地文档。。在服务器那边。。错了很多次。。不是我用的windows主机
将查询结果导入某表中
insert overwrite table cite_count select cited ,count(citing) from cite group by cited;
删除表
drop table +表名
查询表行数
select count(1) from+表名
创建分区列以及桶分布
create table page (vie int,useid int,ip string comment 'ip address of the use') comment 'this is the page view table'
partitioned by (dt string,country string) //分区列
clustered by (useid) into 32 buckets row format //桶
delimited fields terminated by ' ' lines terminated by '\n' //读取条件
STORED AS textfile; //文本格式
导入数据
load data inpath 'hdfs://master:54310/user/root/page.txt' overwrite into table page
partition (dt='2014.3.20',country='china'); //分区条件
查询表
desc + 表名
更改表名
alter table page rename to pag;OK
增加新的列
alter table page add columns (newcol string);
删除一个分区
alter table page drop partition (dt=‘2014.3.20’);
连接操作
SELECT abc.* FROM abc JOIN cite ON (abc.aa = cite.citing);
SELECT a.val, b.val, c.val FROM a JOIN b ON (a.key = b.key1) JOIN c ON (c.key = b.key2)
0 0
- hive 命令
- hive 命令
- Hive命令
- Hive 命令
- hive命令
- hive 命令
- hive命令
- hive命令
- hive之explain命令
- Hive装载数据命令
- Hive基本命令整理
- Hive基本命令整理
- Hive基本命令整理
- Hive基本命令整理
- Hive基本命令(2)
- hive命令参数
- hive 基本命令操作
- hive运维命令
- Linux-Notes-Learning
- HDU 1076An Easy Task
- 安装PLSQL
- 边缘检测 (4)Prewitt边缘算子
- 深入理解Java Class文件格式(三)
- hive 命令
- 关于 hello world 的编制大纲
- github
- Net中unsafe编程详解
- 最大公约数!
- 集合上的动态规划—最优配对问题
- 数据、常量和变量 2014-3-19总结
- 手机显示图片否则网上下载
- 南阳 49 开心的小明