下面列出了怎么用org.apache.hadoop.hbase.mapreduce.TableRecordReader的API类实例代码及写法,或者点击链接到github查看源代码。
@Override
public void open(TableInputSplit split) throws IOException {
if (split == null)
{
throw new IOException("Input split is null!");
}
if (this.table == null)
{
throw new IOException("No HTable provided!");
}
if (this.scan == null)
{
throw new IOException("No Scan instance provided");
}
this.tableRecordReader = new TableRecordReader();
this.tableRecordReader.setHTable(this.table);
Scan sc = new Scan(this.scan);
sc.setStartRow(split.getStartRow());
LOG.info("split start row: " + new String(split.getStartRow()));
sc.setStopRow(split.getEndRow());
LOG.info("split end row: " + new String(split.getEndRow()));
this.tableRecordReader.setScan(sc);
this.tableRecordReader.restart(split.getStartRow());
this.hbaseKey = new HBaseKey();
this.hbaseResult = new HBaseResult();
endReached = false;
}