use of org.apache.accumulo.hadoopImpl.mapred.AccumuloRecordReader in project accumulo by apache.
the class AccumuloRowInputFormat method getRecordReader.
@Override
public RecordReader<Text, PeekingIterator<Entry<Key, Value>>> getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException {
AccumuloRecordReader<Text, PeekingIterator<Entry<Key, Value>>> recordReader = new AccumuloRecordReader<>(CLASS) {
RowIterator rowIterator;
@Override
public void initialize(InputSplit inSplit, JobConf job) throws IOException {
super.initialize(inSplit, job);
rowIterator = new RowIterator(scannerIterator);
}
@Override
public boolean next(Text key, PeekingIterator<Entry<Key, Value>> value) {
if (!rowIterator.hasNext())
return false;
value.initialize(rowIterator.next());
numKeysRead = rowIterator.getKVCount();
key.set((currentKey = value.peek().getKey()).getRow());
return true;
}
@Override
public Text createKey() {
return new Text();
}
@Override
public PeekingIterator<Entry<Key, Value>> createValue() {
return new PeekingIterator<>();
}
};
recordReader.initialize(split, job);
return recordReader;
}
Aggregations