设为首页 加入收藏

TOP

hive的简单使用说明
2015-11-21 01:41:52 来源: 作者: 【 】 浏览:0
Tags:hive 简单 使用说明

I使用:

hive:启动hive

命令必须以分号结束,告诉hive立即执行该命令,不区分大小写

show tables;查看有哪些表

desc tablename; 查看表有哪些列

写sql命令

use udw;

select user_id,action_id

from udw_ml_user_action

where partition_date>=20150410

distribute by user_id

sort by user_id,action_id

limit 10;

执行sql:hive -f test.sql

导出搜索的结果:重定向为其他格式的文件:hive -f *.sql >a.txt

II查询数据的一些命令

order by:完全排序,但只是通过一个reducer来完成,大规模数据集时,效率比较低

sort by:为每个reducer产生一个排序文件

distribute by:控制某个特定行应该到哪个reducer;例如distribute by year 保证所有具有相同年份的行最终都在同一个reducer分区中

group by:根据字段对行分组

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇让你的eclipse实现写JAVA代码,HT.. 下一篇mongodb3.0性能测试报告二

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: