美文网首页
统计PV、UV

统计PV、UV

作者: 编程回忆录 | 来源:发表于2018-09-26 18:46 被阅读0次

使用Hive日常工作基本上都会碰到统计PV、UV的需求,有如下日志表格式表:

create table user_log
(
    log_time string,
    user_id string,
    ....
)

统计一段时间内的PV、UV可以用如下hive sql:

select count(1) as pv,count(distinct user_id) as uv
from user_log
where log_time>='2018-09-01 00:00:00' and log_time<='2018-09-02 23:59:59'

相关文章

网友评论

      本文标题:统计PV、UV

      本文链接:https://www.haomeiwen.com/subject/zojjoftx.html