Package org.apache.hadoop.io

Examples of org.apache.hadoop.io.BytesWritable.compareTo()


    reader.setProjection("a,d,c,f");
    BytesWritable tmp = new BytesWritable();
    DataInputStream dis = reader.getMetaBlock("testMetaBlocks.meta1");
    try {
      tmp.readFields(dis);
      Assert.assertTrue(tmp.compareTo(meta1) == 0);
    } finally {
      dis.close();
    }

    dis = reader.getMetaBlock("testMetaBlocks.meta2");
View Full Code Here


    }

    dis = reader.getMetaBlock("testMetaBlocks.meta2");
    try {
      tmp.readFields(dis);
      Assert.assertTrue(tmp.compareTo(meta2) == 0);
    } finally {
      dis.close();
    }
    reader.close();
  }
View Full Code Here

    // TableScanner scanner = reader.getScanner(null, null, false);
    TableScanner scanner = reader.getScanner(listRanges.get(0), false);
    BytesWritable key = new BytesWritable();
    scanner.getKey(key);
    Assert
        .assertTrue(key.compareTo(new BytesWritable("key11".getBytes())) == 0);
    TypesUtils.resetTuple(row);
    scanner.getValue(row);
    Assert.assertEquals("val1", row.get(0));
    Map<String, String> mapFld2 = (Map<String, String>) row.get(1);
    Assert.assertEquals("boy", mapFld2.get("john"));
View Full Code Here

    // test advance
    scanner2.advance();
    BytesWritable key4 = new BytesWritable();
    scanner2.getKey(key4);
    Assert
        .assertTrue(key4.compareTo(new BytesWritable("key23".getBytes())) == 0);
    TypesUtils.resetTuple(row);
    scanner2.getValue(row);
    Assert.assertEquals("val2", row.get(0));

    Map<String, String> mapFld5 = (Map<String, String>) row.get(1);
View Full Code Here

    reader.setProjection("a,d,c,f");
    BytesWritable tmp = new BytesWritable();
    DataInputStream dis = reader.getMetaBlock("testMetaBlocks.meta1");
    try {
      tmp.readFields(dis);
      Assert.assertTrue(tmp.compareTo(meta1) == 0);
    } finally {
      dis.close();
    }

    dis = reader.getMetaBlock("testMetaBlocks.meta2");
View Full Code Here

    }

    dis = reader.getMetaBlock("testMetaBlocks.meta2");
    try {
      tmp.readFields(dis);
      Assert.assertTrue(tmp.compareTo(meta2) == 0);
    } finally {
      dis.close();
    }
    reader.close();
  }
View Full Code Here

    // TableScanner scanner = reader.getScanner(null, null, false);
    TableScanner scanner = reader.getScanner(listRanges.get(0), false);
    BytesWritable key = new BytesWritable();
    scanner.getKey(key);
    Assert
        .assertTrue(key.compareTo(new BytesWritable("key11".getBytes())) == 0);
    TypesUtils.resetTuple(row);
    scanner.getValue(row);
    Assert.assertEquals("val1", row.get(0));
    Map<String, String> mapFld2 = (Map<String, String>) row.get(1);
    Assert.assertEquals("boy", mapFld2.get("john"));
View Full Code Here

    // test advance
    scanner2.advance();
    BytesWritable key4 = new BytesWritable();
    scanner2.getKey(key4);
    Assert
        .assertTrue(key4.compareTo(new BytesWritable("key23".getBytes())) == 0);
    TypesUtils.resetTuple(row);
    scanner2.getValue(row);
    Assert.assertEquals("val2", row.get(0));

    Map<String, String> mapFld5 = (Map<String, String>) row.get(1);
View Full Code Here

      if (i == 10)
        continue;
      assertTrue(reader.next(key, value));
      assertEquals(i, key.get());
    }
    assertEquals(value.compareTo(new BytesWritable("someValue".getBytes())), 0);
    assertFalse(reader.next(key, value));

    key.set(500);
    assertTrue(reader.seek(key));
    scan(reader, 500);
View Full Code Here

      if (i == 10)
        continue;
      assertTrue(reader.next(key, value));
      assertEquals(i, key.get());
    }
    assertEquals(value.compareTo(new BytesWritable("someValue".getBytes())), 0);
    assertFalse(reader.next(key, value));
   
    key.set(500);
    assertTrue(reader.seek(key));
    scan(reader, 500);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.