Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.Get


      put = new Put(row);
      put.add(fam1, qual1, value2);
      region.put(put);

      // ok get:
      Get get = new Get(row);
      get.addColumn(fam1, qual1);

      Result r = region.get(get);
      assertEquals(1, r.size());
      assertArrayEquals(value2, r.getValue(fam1, qual1));
View Full Code Here


    // Setting up region
    String method = this.getName();
    this.region = initHRegion(tableName, method, conf, fam1);
    try {
      Get get = new Get(row1);
      get.addColumn(fam2, col1);

      // Test
      try {
        region.get(get);
      } catch (org.apache.hadoop.hbase.DoNotRetryIOException e) {
View Full Code Here

      put.add(fam1, col3, null);
      put.add(fam1, col4, null);
      put.add(fam1, col5, null);
      region.put(put);

      Get get = new Get(row1);
      get.addColumn(fam1, col2);
      get.addColumn(fam1, col4);
      // Expected result
      KeyValue kv1 = new KeyValue(row1, fam1, col2);
      KeyValue kv2 = new KeyValue(row1, fam1, col4);
      KeyValue[] expected = { kv1, kv2 };

      // Test
      Result res = region.get(get);
      assertEquals(expected.length, res.size());
      for (int i = 0; i < res.size(); i++) {
        assertTrue(CellUtil.matchingRow(expected[i], res.rawCells()[i]));
        assertTrue(CellUtil.matchingFamily(expected[i], res.rawCells()[i]));
        assertTrue(CellUtil.matchingQualifier(expected[i], res.rawCells()[i]));
      }

      // Test using a filter on a Get
      Get g = new Get(row1);
      final int count = 2;
      g.setFilter(new ColumnCountGetFilter(count));
      res = region.get(g);
      assertEquals(count, res.size());
    } finally {
      HRegion.closeHRegion(this.region);
      this.region = null;
View Full Code Here

    byte[] fam = Bytes.toBytes("fam");

    String method = this.getName();
    this.region = initHRegion(tableName, method, conf, fam);
    try {
      Get get = new Get(row);
      get.addFamily(fam);
      Result r = region.get(get);

      assertTrue(r.isEmpty());
    } finally {
      HRegion.closeHRegion(this.region);
View Full Code Here

  }

  private void assertICV(byte[] row, byte[] familiy, byte[] qualifier, int amount)
      throws IOException {
    // run a get and see?
    Get get = new Get(row);
    get.addColumn(familiy, qualifier);
    Result result = region.get(get);
    assertEquals(1, result.size());

    Cell kv = result.rawCells()[0];
    int r = Bytes.toInt(CellUtil.cloneValue(kv));
View Full Code Here

          }
        }
      });
      ctx.startThreads();

      Get get = new Get(Bytes.toBytes("row0"));
      Result result = null;

      int expectedCount = numFamilies * numQualifiers;

      long prevTimestamp = 0L;
View Full Code Here

    byte[] family = Bytes.toBytes("family");
    this.region = initHRegion(tableName, Bytes.toBytes("x"), Bytes.toBytes("z"), method, conf,
        false, family);
    try {
      byte[] rowNotServed = Bytes.toBytes("a");
      Get g = new Get(rowNotServed);
      try {
        region.get(g);
        fail();
      } catch (WrongRegionException x) {
        // OK
      }
      byte[] row = Bytes.toBytes("y");
      g = new Get(row);
      region.get(g);
    } finally {
      HRegion.closeHRegion(this.region);
      this.region = null;
    }
View Full Code Here

      // Flush
      region.flushcache();

      // Get rows
      Get get = new Get(row);
      get.setMaxVersions();
      Cell[] kvs = region.get(get).rawCells();

      // Check if rows are correct
      assertEquals(4, kvs.length);
      checkOneCell(kvs[0], FAMILY, 0, 0, 4);
View Full Code Here

      Delete del = new Delete(row);
      region.delete(del);
      region.flushcache();

      // Get remaining rows (should have none)
      Get get = new Get(row);
      get.addColumn(familyName, col);

      Cell[] keyValues = region.get(get).rawCells();
      assertTrue(keyValues.length == 0);
    } finally {
      HRegion.closeHRegion(this.region);
View Full Code Here

    }

    incrementDone.set(true);
    flushThread.join();

    Get get = new Get(Incrementer.incRow);
    get.addColumn(Incrementer.family, Incrementer.qualifier);
    get.setMaxVersions(1);
    Result res = this.region.get(get);
    List<Cell> kvs = res.getColumnCells(Incrementer.family, Incrementer.qualifier);

    // we just got the latest version
    assertEquals(kvs.size(), 1);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.client.Get

Copyright © 2018 www.massapicom. 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.