【问题标题】:How can I get the HBase table name from a Result object as the mapreduce parameter?如何从 Result 对象中获取 HBase 表名作为 mapreduce 参数?
【发布时间】:2013-12-26 02:28:02
【问题描述】:

HBASE-3996 支持多个表和扫描仪作为 map/reduce 作业中映射器的输入。 map 函数总是如下所示:

public void map(ImmutableBytesWritable row, Result value, Context context)

在map函数中,如何区分(Result)值来自哪个表?

【问题讨论】:

    标签: mapreduce hbase


    【解决方案1】:

    您可以从上下文中提取 TableSplit,这应该适合您(未经测试):

    public void map(ImmutableBytesWritable row, Result value, Context context) {
        TableSplit currentSplit = (TableSplit)context.getInputSplit();
        byte[] tableName = split.getTableName();
        ....
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-10-06
      • 2016-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-23
      • 2021-07-29
      相关资源
      最近更新 更多