org.apache.hadoop.io.file.tfile.TFile.Reader.Location Java Examples

The following examples show how to use org.apache.hadoop.io.file.tfile.TFile.Reader.Location. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestTFileByteArrays.java    From hadoop-gpu with Apache License 2.0 6 votes vote down vote up
public void testLocate() throws IOException {
  if (skip)
    return;
  writeRecords(3 * records1stBlock);
  Reader reader = new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);
  Scanner scanner = reader.createScanner();
  Location loc2 =
      locate(scanner, composeSortedKey(KEY, 3 * records1stBlock, 2)
          .getBytes());
  Location locLastIn1stBlock =
      locate(scanner, composeSortedKey(KEY, 3 * records1stBlock,
          records1stBlock - 1).getBytes());
  Location locFirstIn2ndBlock =
      locate(scanner, composeSortedKey(KEY, 3 * records1stBlock,
          records1stBlock).getBytes());
  Location locX = locate(scanner, "keyX".getBytes());
  Assert.assertEquals(scanner.endLocation, locX);
  scanner.close();
  reader.close();
}
 
Example #2
Source File: TestTFileByteArrays.java    From hadoop with Apache License 2.0 5 votes vote down vote up
@Test
public void testLocate() throws IOException {
  if (skip)
    return;
  writeRecords(3 * records1stBlock);
  Reader reader = new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);
  Scanner scanner = reader.createScanner();
  locate(scanner, composeSortedKey(KEY, 2).getBytes());
  locate(scanner, composeSortedKey(KEY, records1stBlock - 1).getBytes());
  locate(scanner, composeSortedKey(KEY, records1stBlock).getBytes());
  Location locX = locate(scanner, "keyX".getBytes());
  Assert.assertEquals(scanner.endLocation, locX);
  scanner.close();
  reader.close();
}
 
Example #3
Source File: TestTFileByteArrays.java    From big-c with Apache License 2.0 5 votes vote down vote up
@Test
public void testLocate() throws IOException {
  if (skip)
    return;
  writeRecords(3 * records1stBlock);
  Reader reader = new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);
  Scanner scanner = reader.createScanner();
  locate(scanner, composeSortedKey(KEY, 2).getBytes());
  locate(scanner, composeSortedKey(KEY, records1stBlock - 1).getBytes());
  locate(scanner, composeSortedKey(KEY, records1stBlock).getBytes());
  Location locX = locate(scanner, "keyX".getBytes());
  Assert.assertEquals(scanner.endLocation, locX);
  scanner.close();
  reader.close();
}
 
Example #4
Source File: TestTFileByteArrays.java    From RDFS with Apache License 2.0 5 votes vote down vote up
@Test
public void testLocate() throws IOException {
  if (skip)
    return;
  writeRecords(3 * records1stBlock);
  Reader reader = new Reader(fs.open(path), fs.getFileStatus(path).getLen(), conf);
  Scanner scanner = reader.createScanner();
  locate(scanner, composeSortedKey(KEY, 2).getBytes());
  locate(scanner, composeSortedKey(KEY, records1stBlock - 1).getBytes());
  locate(scanner, composeSortedKey(KEY, records1stBlock).getBytes());
  Location locX = locate(scanner, "keyX".getBytes());
  Assert.assertEquals(scanner.endLocation, locX);
  scanner.close();
  reader.close();
}
 
Example #5
Source File: TestTFileByteArrays.java    From hadoop with Apache License 2.0 4 votes vote down vote up
Location locate(Scanner scanner, byte[] key) throws IOException {
  if (scanner.seekTo(key) == true) {
    return scanner.currentLocation;
  }
  return scanner.endLocation;
}
 
Example #6
Source File: TestTFileByteArrays.java    From big-c with Apache License 2.0 4 votes vote down vote up
Location locate(Scanner scanner, byte[] key) throws IOException {
  if (scanner.seekTo(key) == true) {
    return scanner.currentLocation;
  }
  return scanner.endLocation;
}
 
Example #7
Source File: TestTFileByteArrays.java    From RDFS with Apache License 2.0 4 votes vote down vote up
Location locate(Scanner scanner, byte[] key) throws IOException {
  if (scanner.seekTo(key) == true) {
    return scanner.currentLocation;
  }
  return scanner.endLocation;
}
 
Example #8
Source File: TestTFileByteArrays.java    From hadoop-gpu with Apache License 2.0 4 votes vote down vote up
Location locate(Scanner scanner, byte[] key) throws IOException {
  if (scanner.seekTo(key) == true) {
    return scanner.currentLocation;
  }
  return scanner.endLocation;
}