Java Code Examples for org.apache.hadoop.hbase.mapreduce.TableRecordReader

The following examples show how to use org.apache.hadoop.hbase.mapreduce.TableRecordReader. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: stratosphere   Source File: TableInputFormat.java    License: Apache License 2.0 5 votes vote down vote up
@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;
}