Package org.apache.hadoop.hbase

Examples of org.apache.hadoop.hbase.Cell


    Get get = new Get(row);
    get.addColumn(familiy, qualifier);
    Result result = region.get(get);
    assertEquals(1, result.size());

    Cell kv = result.rawCells()[0];
    long r = Bytes.toLong(CellUtil.cloneValue(kv));
    assertEquals(amount, r);
  }
View Full Code Here


    for (Cell kv : result.rawCells()) {
      if (i >= expKvList.size()) {
        break// we will check the size later
      }

      Cell kvExp = expKvList.get(i++);
      if (toLog) {
        LOG.info("get kv is: " + kv.toString());
        LOG.info("exp kv is: " + kvExp.toString());
      }
      assertTrue("Not equal", kvExp.equals(kv));
    }

    assertEquals(expKvList.size(), result.size());
  }
View Full Code Here

    region.compactStores(true);

    scanner1.reseek(Bytes.toBytes("r2"));
    List<Cell> results = new ArrayList<Cell>();
    scanner1.next(results);
    Cell keyValue = results.get(0);
    Assert.assertTrue(Bytes.compareTo(CellUtil.cloneRow(keyValue), Bytes.toBytes("r2")) == 0);
    scanner1.close();
  }
View Full Code Here

      // Make sure it shows up with an actual timestamp
      Get get = new Get(row).addColumn(fam, qual);
      Result result = region.get(get);
      assertEquals(1, result.size());
      Cell kv = result.rawCells()[0];
      LOG.info("Got: " + kv);
      assertTrue("LATEST_TIMESTAMP was not replaced with real timestamp",
          kv.getTimestamp() != HConstants.LATEST_TIMESTAMP);

      // Check same with WAL enabled (historically these took different
      // code paths, so check both)
      row = Bytes.toBytes("row2");
      put = new Put(row);
      put.add(fam, qual, HConstants.LATEST_TIMESTAMP, Bytes.toBytes("value"));
      region.put(put);

      // Make sure it shows up with an actual timestamp
      get = new Get(row).addColumn(fam, qual);
      result = region.get(get);
      assertEquals(1, result.size());
      kv = result.rawCells()[0];
      LOG.info("Got: " + kv);
      assertTrue("LATEST_TIMESTAMP was not replaced with real timestamp",
          kv.getTimestamp() != HConstants.LATEST_TIMESTAMP);
    } finally {
      HRegion.closeHRegion(this.region);
      this.region = null;
    }
View Full Code Here

      InternalScanner s = region.getScanner(scan);

      List<Cell> results = new ArrayList<Cell>();
      assertEquals(false, s.next(results));
      assertEquals(1, results.size());
      Cell kv = results.get(0);

      assertArrayEquals(value2, CellUtil.cloneValue(kv));
      assertArrayEquals(fam1, CellUtil.cloneFamily(kv));
      assertArrayEquals(qual1, CellUtil.cloneQualifier(kv));
      assertArrayEquals(row, CellUtil.cloneRow(kv));
View Full Code Here

    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));
    assertEquals(amount, r);
  }
View Full Code Here

              timestamp = kv.getTimestamp();
            }
          }
          assertTrue(timestamp >= prevTimestamp);
          prevTimestamp = timestamp;
          Cell previousKV = null;

          for (Cell kv : result.rawCells()) {
            byte[] thisValue = CellUtil.cloneValue(kv);
            if (previousKV != null) {
              if (Bytes.compareTo(CellUtil.cloneValue(previousKV), thisValue) != 0) {
                LOG.warn("These two KV should have the same value." + " Previous KV:" + previousKV
                    + "(memStoreTS:" + previousKV.getMvccVersion() + ")" + ", New KV: " + kv
                    + "(memStoreTS:" + kv.getMvccVersion() + ")");
                assertEquals(0, Bytes.compareTo(CellUtil.cloneValue(previousKV), thisValue));
              }
            }
            previousKV = kv;
View Full Code Here

    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);
    Cell kv = kvs.get(0);
    assertEquals(expected, Bytes.toLong(kv.getValueArray(), kv.getValueOffset()));
    this.region = null;
  }
View Full Code Here

    Result res = this.region.get(get);
    List<Cell> kvs = res.getColumnCells(Appender.family, Appender.qualifier);

    // we just got the latest version
    assertEquals(kvs.size(), 1);
    Cell kv = kvs.get(0);
    byte[] appendResult = new byte[kv.getValueLength()];
    System.arraycopy(kv.getValueArray(), kv.getValueOffset(), appendResult, 0, kv.getValueLength());
    assertArrayEquals(expected, appendResult);
    this.region = null;
  }
View Full Code Here

    for (Cell kv : result.rawCells()) {
      if (i >= expKvList.size()) {
        break// we will check the size later
      }

      Cell kvExp = expKvList.get(i++);
      if (toLog) {
        LOG.info("get kv is: " + kv.toString());
        LOG.info("exp kv is: " + kvExp.toString());
      }
      assertTrue("Not equal", kvExp.equals(kv));
    }

    assertEquals(expKvList.size(), result.size());
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.Cell

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.