单表关联
来源:互联网 发布:自制手机网络接收器 编辑:程序博客网 时间:2024/05/29 07:40
输入:
child parent
tom jack
tom lucy
jone jack
jone lucy
jack ben
jack alice
lucy fred
lucy jin
输出:
grandchild grandparent
tom ben
tom alice
tom fred
tom jin
jone ben
jone alice
jone fred
jone jin
分析:
1 这是一张表,我们可以用sql查出,如:select a1.child, a2.parent from A a1, A a2 where a1.parent = a2.child
2 在mapreduce中我们要形成左表和右表,考虑到mapreduce处理过程中有shuffle过程,即会把key相同键值对进行分组
3 在map形成左表和右表,如:
jack 1 + tom + jack(parent 1+child+parent)
tom 2 + tom + jack(child 2+child+parent)
lucy 1 + tom + lucy
tom 2 + tom + lucy
jack 1 + jone + jack
jone 2 + jone + jack
lucy 1 + jone + lucy
jone 2 + jone + lucy
ben 1 + jack + ben
jack 2 + jack + ben
alice 1 + jack + alices
jack 2 + jack + alice
fred 1 + lucy + fred
lucy 2 + lucy + fred
jin 1 + lucy + jin
lucy 2 + lucy + jin
其中1代表左表,2 代表右表
4 到reduce端会进行分组,如:jack{1 + tom + jack,1 + jone + jack,2 + jack + ben,2 + jack + alice}
这样jack作为父亲和儿子的所有数据都拿到了,然后在进行处理(笛卡尔积),即可得到结果
0 0
- hadoop单表关联
- hadoop单表关联
- MapReduce单表关联
- 单表关联
- 单表关联
- hadoop--单表关联
- Hadoop 单表关联 多表关联
- MapReduce实现单表关联
- MapReduce实现单表关联
- hadoop学习--单表关联
- hadoop学习--单表关联
- MapReduce单表关联实验
- MapReduce实现单表关联
- MapReduce实战【单表关联】
- MapReduce实例----单表关联
- 单表关联查询MR
- Hadoop单表与多表关联
- hadoop编程实例--单表关联
- Android异步消息处理机制总结笔记
- UE4 命令行参数
- windows下 vs2008命令行模式 编译apache+openssl
- vc++ 获的dll版本信息
- eclipse+maven建置servlet项目
- 单表关联
- hdu2105 The Center of Gravity 水题
- 日期和时间的使用
- RESTful的简单理解
- 党政机关公文格式
- 2016.10.20 开启自己的博客之路
- SQL Server 2008R2 数据库出现"可疑"导致无法访问解决办法
- libjpeg实现内存内位图的压缩及解压缩
- 解决android 5.0 webview不能加载http与https混合内容的问题