0
点赞
收藏
分享

微信扫一扫

MapReduce之TableMapper类

程序猿不脱发2 2022-01-28 阅读 48


MapReduce之TableMapper类

1.源码

package org.apache.hadoop.hbase.mapreduce;

import org.apache.hadoop.hbase.classification.InterfaceAudience;
import org.apache.hadoop.hbase.classification.InterfaceStability;
import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.mapreduce.Mapper;

@param <KEYOUT> The type of the key.
@param <VALUEOUT> The type of the value.
@see org.apache.hadoop.mapreduce.Mapper

@InterfaceAudience.Public
@InterfaceStability.Stable
public abstract class TableMapper<KEYOUT, VALUEOUT>
extends Mapper<ImmutableBytesWritable, Result, KEYOUT, VALUEOUT> {
}

二.简介

2.1 参数简介

​Extends the base Mapper class to add the required input key and value classes.​

​TableMapper​​继承自​​Mapper​​类。但是​​Mapper​​类有四个输入泛型,为何这里的​​TableMapper​​只有两个呢?通过源码,可以看到​​TableMapper​​的​​KEYIN,VALUEIN​​分别设置为​​ImmutabelBytesWriteable​​和​​Result​​类型,所以只需要实现​​KEYOUT,VALUEOUT​​即可。

2.2 这里的TableMapper类完全是为了从​​HBase​​中读取数据而设置的,也就是说,这个TableMapper是专为HBase定义的抽象类。

三.示例

实战程序详见我的 ​​电信大数据项目​​



举报

相关推荐

0 条评论