KEY
- The key type.VALUE
- The value type.public abstract class IteratorBasedSplitReader<KEY,VALUE> extends SplitReaderBase<KEY,VALUE>
SplitReader
backed by Iterator
.Constructor and Description |
---|
IteratorBasedSplitReader() |
Modifier and Type | Method and Description |
---|---|
protected abstract Iterator<VALUE> |
createIterator(Split split)
Creates an iterator to iterate through all records of a given split.
|
protected boolean |
fetchNextKeyValue()
Fetches the next data item of the split being read.
|
protected abstract KEY |
getKey(VALUE value)
Gets the key belonging to the key/value record provided by the iterator.
|
void |
initialize(Split split)
Called once at initialization.
|
close, getCurrentKey, getCurrentValue, nextKeyValue, setCurrentKeyValue
getProgress
protected abstract Iterator<VALUE> createIterator(Split split)
split
- Split to iterate through.Iterator
.protected abstract KEY getKey(VALUE value)
value
- The value of the key/value record.public void initialize(Split split) throws InterruptedException
SplitReader
initialize
in class SplitReader<KEY,VALUE>
split
- The split that defines the range of records to read.InterruptedException
protected boolean fetchNextKeyValue()
SplitReaderBase
SplitReaderBase.setCurrentKeyValue(Object, Object)
method to
set the new current key/value. If false there are no more key/value records to read.
See IteratorBasedSplitReader
for an implementation
of the abstract fetchNextKeyValue() method.fetchNextKeyValue
in class SplitReaderBase<KEY,VALUE>
Copyright © 2022 Cask Data, Inc. Licensed under the Apache License, Version 2.0.