zoukankan      html  css  js  c++  java
  • 2017 级课堂测试试卷—数据清洗

    Result文件数据说明:

    Ip106.39.41.166,(城市)

    Date10/Nov/2016:00:01:02 +0800,(日期)

    Day10,(天数)

    Traffic: 54 ,(流量)

    Type: video,(类型:视频video或文章article

    Id: 8701(视频或者文章的id

    测试要求:

    1、 数据清洗:按照进行数据清洗,并将清洗后的数据导入hive数据库中

    两阶段数据清洗:

    1)第一阶段:把需要的信息从原始日志中提取出来

    ip:    199.30.25.88

    time:  10/Nov/2016:00:01:03 +0800

    traffic:  62

    文章: article/11325

    视频: video/3235

    2)第二阶段:根据提取出来的信息做精细化操作

    ip--->城市 cityIP

    date--> time:2016-11-10 00:01:03

    day: 10

    traffic:62

    type:article/video

    id:11325

    3hive数据库表结构:

    create table data(  ip string,  time string , day string, traffic bigint,

    type string, id   string )

     

    2、数据处理:

    ·统计最受欢迎的视频/文章的Top10访问次数 (video/articleid

    create table id_count as

       

        select word,count(*) as cnt from

        

        (select explode(split(id,' ')) as word from data) w    

        

        group by word

        

        order by cnt desc;

     

    ·按照地市统计最受欢迎的Top10课程 (ip

    create table ip_count as

       

        select word,count(*) as cnt from

        

        (select explode(split(ip,' ')) as word from data) w    

        

        group by word

        

        order by cnt desc;

     

    ·按照流量统计最受欢迎的Top10课程 (traffic

    create table traffic_count as select id,sum(traffic) as cnt from data group by id order by cnt desc;

     

    2、 数据可视化:将统计结果倒入MySql数据库中,通过图形化展示的方式展现出来。

     

     

     

     

  • 相关阅读:
    Codeforces Round #642 (Div. 3)
    [P4980] 【模板】Polya定理
    [SCOI2016] 幸运数字
    [P4389] 付公主的背包
    [CF438E] The Child and Binary Tree
    最长异或路径
    [AHOI2013] 作业
    [P4841] [集训队作业2013] 城市规划
    Python 第三方库国内镜像安装
    [CF1202D] Print a 1337-string...
  • 原文地址:https://www.cnblogs.com/quxiangjia/p/11853226.html
Copyright © 2011-2022 走看看