@SuppressWarnings({"deprecation", "unchecked"})
 public void testMergeShouldReturnProperProgress(List<Segment<Text, Text>> segments)
     throws IOException {
   Path tmpDir = new Path("localpath");
   Class<Text> keyClass = (Class<Text>) jobConf.getMapOutputKeyClass();
   Class<Text> valueClass = (Class<Text>) jobConf.getMapOutputValueClass();
   RawComparator<Text> comparator = jobConf.getOutputKeyComparator();
   Counter readsCounter = new Counter();
   Counter writesCounter = new Counter();
   Progress mergePhase = new Progress();
   RawKeyValueIterator mergeQueue =
       Merger.merge(
           conf,
           fs,
           keyClass,
           valueClass,
           segments,
           2,
           tmpDir,
           comparator,
           getReporter(),
           readsCounter,
           writesCounter,
           mergePhase);
   Assert.assertEquals(1.0f, mergeQueue.getProgress().get(), 0.0f);
 }
Exemple #2
0
 public boolean nextRawKey(DataInputBuffer key) throws IOException {
   if (kvIter.next()) {
     final DataInputBuffer kb = kvIter.getKey();
     final int kp = kb.getPosition();
     final int klen = kb.getLength() - kp;
     key.reset(kb.getData(), kp, klen);
     bytesRead += klen;
     return true;
   }
   return false;
 }
Exemple #3
0
 public void nextRawValue(DataInputBuffer value) throws IOException {
   final DataInputBuffer vb = kvIter.getValue();
   final int vp = vb.getPosition();
   final int vlen = vb.getLength() - vp;
   value.reset(vb.getData(), vp, vlen);
   bytesRead += vlen;
 }
Exemple #4
0
 public void close() throws IOException {
   kvIter.close();
 }