K - key object typeV - value object typepublic class KeyValueSorter<K,V> extends Object implements Closeable
| Modifier and Type | Class and Description |
|---|---|
static class |
KeyValueSorter.Options
Settings for
KeyValueSorter. |
| Constructor and Description |
|---|
KeyValueSorter(org.apache.hadoop.io.serializer.SerializationFactory serialization,
Class<K> keyClass,
Class<V> valueClass,
org.apache.hadoop.io.RawComparator<?> comparator,
KeyValueSorter.Options options)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
Class<K> |
getKeyClass()
Returns the target key class.
|
long |
getRecordCount()
Returns the total record count.
|
long |
getSizeInBytes()
Returns the total size in bytes.
|
Class<V> |
getValueClass()
Returns the target value class.
|
void |
put(K key,
V value)
Puts key and value into this buffer.
|
Source<KeyValueSlice> |
sort()
Sort previously added key-value pairs.
|
public KeyValueSorter(org.apache.hadoop.io.serializer.SerializationFactory serialization,
Class<K> keyClass,
Class<V> valueClass,
org.apache.hadoop.io.RawComparator<?> comparator,
KeyValueSorter.Options options)
serialization - the serialization factorykeyClass - the key classvalueClass - the value classcomparator - the shuffle sort comparatoroptions - the sorter optionspublic Class<V> getValueClass()
public void put(K key, V value) throws IOException, InterruptedException
key - the key objectvalue - the value objectIOException - if failed to put objectsInterruptedException - if interrupted while putting objectpublic long getRecordCount()
public long getSizeInBytes()
public Source<KeyValueSlice> sort() throws IOException, InterruptedException
IOException - if failed to sort pairsInterruptedException - if interrupted while preparingpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 2011–2019 Asakusa Framework Team. All rights reserved.