【发布时间】:2016-09-22 23:54:52
【问题描述】:
我可以从我的 reducer 将输出写入 HBase 中的多个表吗?我浏览了不同的博客文章,但即使使用MultiTableOutputFormat,也找不到方法。
我提到了这个:Write to multiple tables in HBASE
但无法找出 context.write 调用的 API 签名。
减速器代码:
public class MyReducer extends TableReducer<Text, Result, Put> {
private static final Logger logger = Logger.getLogger( MyReducer.class );
@SuppressWarnings( "deprecation" )
@Override
protected void reduce( Text key, Iterable<Result> data, Context context ) throws IOException, InterruptedException {
logger.info( "Working on ---> " + key.toString() );
for ( Result res : data ) {
Put put = new Put( res.getRow() );
KeyValue[] raw = res.raw();
for ( KeyValue kv : raw ) {
put.add( kv );
}
context.write( obj, put );
**// I dont know how to give table name here.**
}
}
}
【问题讨论】: