Search in sources :

Example 1 with Location

use of org.apache.hadoop.io.file.tfile.TFile.Reader.Location in project hadoop by apache.

the class TestTFileByteArrays method testLocate.

@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();
}
Also used : Scanner(org.apache.hadoop.io.file.tfile.TFile.Reader.Scanner) Reader(org.apache.hadoop.io.file.tfile.TFile.Reader) Location(org.apache.hadoop.io.file.tfile.TFile.Reader.Location) Test(org.junit.Test)

Aggregations

Reader (org.apache.hadoop.io.file.tfile.TFile.Reader)1 Location (org.apache.hadoop.io.file.tfile.TFile.Reader.Location)1 Scanner (org.apache.hadoop.io.file.tfile.TFile.Reader.Scanner)1 Test (org.junit.Test)1