|
@@ -97,6 +97,25 @@ class Merger {
|
|
|
mergePhase);
|
|
|
}
|
|
|
|
|
|
+ public static <K extends Object, V extends Object>
|
|
|
+ RawKeyValueIterator merge(Configuration conf, FileSystem fs,
|
|
|
+ Class<K> keyClass, Class<V> valueClass,
|
|
|
+ CompressionCodec codec,
|
|
|
+ List<Segment<K, V>> segments,
|
|
|
+ int mergeFactor, Path tmpDir,
|
|
|
+ RawComparator<K> comparator, Progressable reporter,
|
|
|
+ boolean sortSegments,
|
|
|
+ Counters.Counter readsCounter,
|
|
|
+ Counters.Counter writesCounter,
|
|
|
+ Progress mergePhase)
|
|
|
+ throws IOException {
|
|
|
+ return new MergeQueue<K, V>(conf, fs, segments, comparator, reporter,
|
|
|
+ sortSegments, codec).merge(keyClass, valueClass,
|
|
|
+ mergeFactor, tmpDir,
|
|
|
+ readsCounter, writesCounter,
|
|
|
+ mergePhase);
|
|
|
+ }
|
|
|
+
|
|
|
static <K extends Object, V extends Object>
|
|
|
RawKeyValueIterator merge(Configuration conf, FileSystem fs,
|
|
|
Class<K> keyClass, Class<V> valueClass,
|
|
@@ -116,6 +135,27 @@ class Merger {
|
|
|
mergePhase);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ static <K extends Object, V extends Object>
|
|
|
+ RawKeyValueIterator merge(Configuration conf, FileSystem fs,
|
|
|
+ Class<K> keyClass, Class<V> valueClass,
|
|
|
+ CompressionCodec codec,
|
|
|
+ List<Segment<K, V>> segments,
|
|
|
+ int mergeFactor, int inMemSegments, Path tmpDir,
|
|
|
+ RawComparator<K> comparator, Progressable reporter,
|
|
|
+ boolean sortSegments,
|
|
|
+ Counters.Counter readsCounter,
|
|
|
+ Counters.Counter writesCounter,
|
|
|
+ Progress mergePhase)
|
|
|
+ throws IOException {
|
|
|
+ return new MergeQueue<K, V>(conf, fs, segments, comparator, reporter,
|
|
|
+ sortSegments, codec).merge(keyClass, valueClass,
|
|
|
+ mergeFactor, inMemSegments,
|
|
|
+ tmpDir,
|
|
|
+ readsCounter, writesCounter,
|
|
|
+ mergePhase);
|
|
|
+}
|
|
|
+
|
|
|
public static <K extends Object, V extends Object>
|
|
|
void writeFile(RawKeyValueIterator records, Writer<K, V> writer,
|
|
|
Progressable progressable, Configuration conf)
|
|
@@ -326,6 +366,13 @@ class Merger {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public MergeQueue(Configuration conf, FileSystem fs,
|
|
|
+ List<Segment<K, V>> segments, RawComparator<K> comparator,
|
|
|
+ Progressable reporter, boolean sortSegments, CompressionCodec codec) {
|
|
|
+ this(conf, fs, segments, comparator, reporter, sortSegments);
|
|
|
+ this.codec = codec;
|
|
|
+ }
|
|
|
+
|
|
|
public void close() throws IOException {
|
|
|
Segment<K, V> segment;
|
|
|
while((segment = pop()) != null) {
|