通过hadoop上的hive完成WordCount

  • 启动hadoop
  • Hdfs上创建文件夹
  • 上传文件至hdfs
  • 启动Hive
  • 创建原始文档表
  • 导入文件内容到表docs并查看
  • 用HQL进行词频统计,结果放在表word_count里
  • 查看统计结果

以上的要求实现如下:


start-all.sh
hdfs dfs -put ~/wordcount.txt input/wordcount.txt
hive > create database test02;
> create table test02(content string);
> load data inpath '/user/hadoop/input/wordcount.txt' into table test02;
> create table test03 as select word, count(1) as count from (select explode(split(regexp_replace(content, ',|\\.', ' ') , ' ')) as word from test02) word group by word;
> select * from test03;

以下是运行结果截图:

最新文章

  1. MTK MT33xx型GPS的NMEA协议解析实例
  2. Mosquitto搭建Android推送服务(一)MQTT简介
  3. cocoapods无法使用(mac os 10.11升级导致pod: command not found)
  4. Perl中的匹配(六)
  5. CentOS下修复grub引导程序
  6. SQL查询数据库信息, 数据库表名, 数据库表信息
  7. Python-Day7 面向对象进阶/异常处理/Socket
  8. JavaScript高级程序设计(第三版)学习笔记8、9、10章
  9. Linux 新手常用命令
  10. poj 2240 Arbitrage (Floyd)
  11. 探讨VMP 2.12.3 导入表修复
  12. ubuntu_安装aptana3
  13. PHP能引起安全的函数
  14. 【Win 10 应用开发】MIDI 音乐合成——乐理篇
  15. 爬虫_vs_反爬虫
  16. chrome 扩展 调试
  17. activiti主要API对象
  18. iOS 9应用开发教程之ios9中实现按钮的响应
  19. 如何重构"箭头型"代码
  20. jQuery checkbox选中问题之prop与attr注意点分析

热门文章

  1. MIP 技术月报(4月):支持熊掌号登录;优化页面悬浮元素
  2. SpringBoot集成Lombok,应用+源码解析,让代码优雅起来
  3. Oracle 中的SELECT 关键字(查询、检索)
  4. cesium 之图层管理器篇(附源码下载)
  5. 有关Windows10中诊断和反馈隐私设置
  6. pytest进阶之html测试报告
  7. x宝23大洋包邮的老式大朝华MP3播放器简单评测
  8. 使用whistle模拟cgi接口异常:错误码、502、慢网速、超时
  9. Scanner类详解
  10. IM开发者的零基础通信技术入门(一):通信交换技术的百年发展史(上)