HIVE SQL 实践

版权声明:个人 https://blog.csdn.net/csdnmrliu/article/details/82783393

1. select语句

1.1 简单查询

注:最好不要使用 select *

select * from test.imsiBackFill where date_id = 20180920 and hour = 10 limit 10;

1.2 统计行数

select count(1) from test.imsiBackFill where date_id = 20180920 and hour = 10;

#和直接查看HDFS文件结果是一样的
hadoop fs -cat hdfs://mace:9000/user/hive/warehouse/test.db/imsibackfill/date_id=20180920/hour=10/*|wc -l

2.group by

2.1 通过 group by 实现去重统计

select count(1) from (select enodebid from test.imsiBackFill where date_id = 20180920 and hour = 10 group by enodebid) a;

猜你喜欢

转载自blog.csdn.net/csdnmrliu/article/details/82783393
今日推荐