Hive2 beeline
–Beeline 要与HiveServer2配合使用,支持嵌入模式和远程模式
–启动HiverServer2 ,./bin/hiveserver2
–启动Beeline
–wangyue@wangyue-um:~/opt/hive/hive-0.12.0-cdh5.1.0$ ./bin/beeline
–beeline> !connect jdbc:hive2://localhost:10000
–默认用户名、密码不验证
•配置文件hive.server2.authentication默认为NONE
下面的t 是必须的
select * from (
select imei,sum(drop_num) drop_num,sum(duration) duration,(sum(drop_num) / sum(duration)) AS dd from phone_detail group by imei ) t order by t.dd desc
limit 10;
+---------+-------------+-------------+------------------------+--+
| t.imei | t.drop_num | t.duration | t.dd |
+---------+-------------+-------------+------------------------+--+
| 639876 | 1 | 734 | 0.0013623978201634877 |
| 356436 | 1 | 1028 | 9.727626459143969E-4 |
| 351760 | 1 | 1232 | 8.116883116883117E-4 |
| 368883 | 1 | 1448 | 6.906077348066298E-4 |
| 358849 | 1 | 1469 | 6.807351940095302E-4 |
| 358231 | 1 | 1613 | 6.199628022318661E-4 |
| 863738 | 2 | 3343 | 5.982650314089142E-4 |
| 865011 | 1 | 1864 | 5.36480686695279E-4 |
| 862242 | 1 | 1913 | 5.227391531625719E-4 |
| 350301 | 2 | 3998 | 5.002501250625312E-4 |
+---------+-------------+-------------+------------------------+--+
毛泽东思想告诉我们,活着就要扯蛋,斗争