Examples of Get


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

    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, null);
    assertEquals(expected.length, res.size());
    for(int i=0; i<res.size(); i++){
      assertEquals(0,
          Bytes.compareTo(expected[i].getRow(), res.raw()[i].getRow()));
      assertEquals(0,
          Bytes.compareTo(expected[i].getFamily(), res.raw()[i].getFamily()));
      assertEquals(0,
          Bytes.compareTo(
              expected[i].getQualifier(), res.raw()[i].getQualifier()));
    }

    // 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, null);
    assertEquals(count, res.size());
  }
View Full Code Here

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

    byte [] fam = Bytes.toBytes("fam");
   
    String method = this.getName();
    initHRegion(tableName, method, fam);
   
    Get get = new Get(row);
    get.addFamily(fam);
    Result r = region.get(get, null);
   
    assertTrue(r.isEmpty());
  }
View Full Code Here

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

    //Add to memstore
    Put put = new Put(HConstants.EMPTY_START_ROW);
    put.add(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER, null);
    region.put(put);
   
    Get get = new Get(HConstants.EMPTY_START_ROW);
    get.addColumn(HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER);

    //Expected result
    KeyValue kv1 = new KeyValue(HConstants.EMPTY_START_ROW,
        HConstants.CATALOG_FAMILY, HConstants.REGIONINFO_QUALIFIER);
    KeyValue [] expected = {kv1};
View Full Code Here

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

    region.put(put);

    long result = region.incrementColumnValue(row, fam1, qual3, amount, true);
    assertEquals(amount, result);

    Get get = new Get(row);
    get.addColumn(fam1, qual3);
    Result rr = region.get(get, null);
    assertEquals(1, rr.size());

    // ensure none of the other cols were incremented.
    assertICV(row, fam1, qual1, value);
View Full Code Here

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

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

    KeyValue kv = result.raw()[0];
    long r = Bytes.toLong(kv.getValue());
View Full Code Here

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

    PutThread putThread = new PutThread(numRows, families, qualifiers);
    putThread.start();
    FlushThread flushThread = new FlushThread();
    flushThread.start();

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

    int expectedCount = numFamilies * numQualifiers;

    long prevTimestamp = 0L;
View Full Code Here

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

  private void verifyData(HRegion newReg, int startRow, int numRows, byte [] qf,
      byte [] ... families)
  throws IOException {
    for(int i=startRow; i<startRow + numRows; i++) {
      byte [] row = Bytes.toBytes("" + i);
      Get get = new Get(row);
      for(byte [] family : families) {
        get.addColumn(family, qf);
      }
      Result result = newReg.get(get, null);
      KeyValue [] raw = result.sorted();
      assertEquals(families.length, result.size());
      for(int j=0; j<families.length; j++) {
View Full Code Here

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

  }

  private void assertGet(final HRegion r, final byte [] family, final byte [] k)
  throws IOException {
    // Now I have k, get values out and assert they are as expected.
    Get get = new Get(k).addFamily(family).setMaxVersions();
    KeyValue [] results = r.get(get, null).raw();
    for (int j = 0; j < results.length; j++) {
      byte [] tmp = results[j].getValue();
      // Row should be equal to value every time.
      assertTrue(Bytes.equals(k, tmp));
View Full Code Here

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

   * HBASE-1784).
   * @param hri Region to assign.
   */
  private void assignSplitDaughter(final HRegionInfo hri) {
    MetaRegion mr = this.master.regionManager.getFirstMetaRegionForRegion(hri);
    Get g = new Get(hri.getRegionName());
    g.addFamily(HConstants.CATALOG_FAMILY);
    try {
      HRegionInterface server =
        master.connection.getHRegionConnection(mr.getServer());
      Result r = server.get(mr.getRegionName(), g);
      // If size > 3 -- presume regioninfo, startcode and server -- then presume
View Full Code Here

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

    // Scans are sloppy. They don't respect row locks and they get and
    // cache a row internally so may have data that is stale. Make sure that for
    // sure we have the right server and servercode. We are trying to avoid
    // double-assignments. See hbase-1784. Will have to wait till 0.21 hbase
    // where we use zk to mediate state transitions to do better.
    Get g = new Get(info.getRegionName());
    g.addFamily(HConstants.CATALOG_FAMILY);
    Result r = regionServer.get(meta.getRegionName(), g);
    if (r != null && !r.isEmpty()) {
      sa = getServerAddress(r);
      if (sa != null && sa.length() > 0 && !sa.equalsIgnoreCase(serverAddress)) {
        LOG.debug("GET on " + info.getRegionNameAsString() + " got different " +
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.