zoukankan      html  css  js  c++  java
  • Hadoop综合大作业

    Hadoop综合大作业 要求:

    1.用Hive对爬虫大作业产生的文本文件(或者英文词频统计下载的英文长篇小说)进行词频统计。

    我下载的是一篇英文长篇小说《教父》,字数为个,

     

    将文章(godfather.txt)放在了wc文件中:

    启动hadoop:

    start-all.sh
    jps
    

      

    文件上传至hdfs

    hdfs dfs -put ./godfather.txt /bigdatacase/dataset
    hdfs dfs -ls /bigdatacase/dataset
    

      

    启动hive

     hive

    创建原始文档表

    create table novel(long string);
    

      

    导入文件内容到表novel

     
    load data inpath '/bigdatacase/dataset/godfather.txt' overwrite into table novel;
    

      

    进行词频统计并放入表novelcount表中

     
    create table novelcount as select word,count(1) from (select(long,' ')) as word from novel) word group by word;
    

      

    查看统计结果(前20个)

     
    select * from novelcount limit 20
    

      

  • 相关阅读:
    游戏运营-三节课
    游戏运营-游戏付费
    游戏运营--资深
    django 导出csv
    django-分页
    django-中间件
    django-缓存
    django post 与get请求理解
    django 中遇到的问题
    Linux下使用XAMPP
  • 原文地址:https://www.cnblogs.com/piglet00/p/9082649.html
Copyright © 2011-2022 走看看