hive基本操作与应用
2024-09-30 02:43:45
通过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;
以下是运行结果截图:
最新文章
- MTK MT33xx型GPS的NMEA协议解析实例
- Mosquitto搭建Android推送服务(一)MQTT简介
- cocoapods无法使用(mac os 10.11升级导致pod: command not found)
- Perl中的匹配(六)
- CentOS下修复grub引导程序
- SQL查询数据库信息, 数据库表名, 数据库表信息
- Python-Day7 面向对象进阶/异常处理/Socket
- JavaScript高级程序设计(第三版)学习笔记8、9、10章
- Linux 新手常用命令
- poj 2240 Arbitrage (Floyd)
- 探讨VMP 2.12.3 导入表修复
- ubuntu_安装aptana3
- PHP能引起安全的函数
- 【Win 10 应用开发】MIDI 音乐合成——乐理篇
- 爬虫_vs_反爬虫
- chrome 扩展 调试
- activiti主要API对象
- iOS 9应用开发教程之ios9中实现按钮的响应
- 如何重构";箭头型";代码
- jQuery checkbox选中问题之prop与attr注意点分析