Package org.apache.hadoop.hbase.io

Examples of org.apache.hadoop.hbase.io.Cell$CellIterator


  private boolean get(final HStoreKey key, final byte [] value,
      final int versions, final List<Cell> results,
      final Set<HStoreKey> deletes, final long now) {
    if (!HLogEdit.isDeleted(value)) {
      if (notExpiredAndNotInDeletes(this.ttl, key, now, deletes)) {
        results.add(new Cell(value, key.getTimestamp()));
      }
      // Perhaps only one version is wanted.  I could let this
      // test happen later in the for loop test but it would cost
      // the allocation of an ImmutableBytesWritable.
      if (hasEnoughVersions(versions, results)) {
View Full Code Here


      try {
        RowResult results = getMetaRow();
        if (results == null) {
          return null;
        }
        Cell regionInfo = results.get(COL_REGIONINFO);
        if (regionInfo == null || regionInfo.getValue().length == 0) {
          throw new NoSuchElementException("meta region entry missing " +
            COL_REGIONINFO);
        }
        HRegionInfo region = Writables.getHRegionInfo(regionInfo.getValue());
        if (!Bytes.equals(region.getTableDesc().getName(), this.tableName)) {
          return null;
        }
        checkOfflined(region);
        return region;
View Full Code Here

    private RowResult getMetaRow() throws IOException {
      RowResult currentRow = metaScanner.next();
      boolean foundResult = false;
      while (currentRow != null) {
        LOG.info("Row: <" + currentRow.getRow() + ">");
        Cell regionInfo = currentRow.get(COL_REGIONINFO);
        if (regionInfo == null || regionInfo.getValue().length == 0) {
          currentRow = metaScanner.next();
          continue;
        }
        foundResult = true;
        break;
View Full Code Here

 
  private void verifyGet(final HRegionIncommon r, final String expectedServer)
  throws IOException {
    // This should return a value because there is only one family member
    Cell value = r.get(ROW_KEY, CONTENTS);
    assertNotNull(value);
   
    // This should not return a value because there are multiple family members
    value = r.get(ROW_KEY, HConstants.COLUMN_FAMILY);
    assertNull(value);
View Full Code Here

 
  protected void assertCellEquals(final HRegion region, final byte [] row,
    final byte [] column, final long timestamp, final String value)
  throws IOException {
    Map<byte [], Cell> result = region.getFull(row, null, timestamp);
    Cell cell_value = result.get(column);
    if(value == null){
      assertEquals(column.toString() + " at timestamp " + timestamp, null, cell_value);
    } else {
      if (cell_value == null) {
        fail(column.toString() + " at timestamp " + timestamp +
          "\" was expected to be \"" + value + " but was null");
      }
      if (cell_value != null) {
        assertEquals(column.toString() + " at timestamp "
            + timestamp, value, new String(cell_value.getValue()));
      }
    }
  }
View Full Code Here

    OutputCollector<ImmutableBytesWritable, RowResult> output,
    @SuppressWarnings("unused") Reporter reporter)
  throws IOException {
    boolean content = false;
    for (Map.Entry<byte [], Cell> e: value.entrySet()) {
      Cell cell = e.getValue();
      if (cell != null && cell.getValue().length > 0) {
        content = true;
        break;
      }
    }
    if (!content) {
View Full Code Here

  protected void setUp() throws Exception {
    super.setUp();
    this.colvalues = new TreeMap<byte [], Cell>(Bytes.BYTES_COMPARATOR);
    for (char c = FIRST_CHAR; c < LAST_CHAR; c++) {
      colvalues.put(Bytes.toBytes(new String(new char [] {c})),
          new Cell(GOOD_BYTES, HConstants.LATEST_TIMESTAMP));
    }
    this.mainFilter = new RegExpRowFilter(HOST_PREFIX + ".*", colvalues);
  }
View Full Code Here

    // Try a row that has all expected columnKeys, and NO null-expected
    // columnKeys.
    // Testing row with columnKeys: a-d
    colvalues.put(new byte [] {(byte)secondToLast},
        new Cell(GOOD_BYTES, HConstants.LATEST_TIMESTAMP));
    assertFalse("Failed with last columnKey " + secondToLast, filter.
      filterRow(colvalues));

    // Try a row that has all expected columnKeys AND a null-expected columnKey.
    // Testing row with columnKeys: a-e
    colvalues.put(new byte [] {LAST_CHAR},
        new Cell(GOOD_BYTES, HConstants.LATEST_TIMESTAMP));
    assertTrue("Failed with last columnKey " + LAST_CHAR, filter.
      filterRow(colvalues));
   
    // Try a row that has all expected columnKeys and a null-expected columnKey
    // that maps to a null value.
    // Testing row with columnKeys: a-e, e maps to null
    colvalues.put(new byte [] {LAST_CHAR},
      new Cell(HLogEdit.deleteBytes.get(), HConstants.LATEST_TIMESTAMP));
    assertFalse("Failed with last columnKey " + LAST_CHAR + " mapping to null.",
      filter.filterRow(colvalues));
  }
View Full Code Here

  private void scanTableWithRowFilter(final String tableName, final boolean printValues) throws IOException {
    HTable table = new HTable(conf, tableName);
    Map<byte [], Cell> columnMap = new HashMap<byte [], Cell>();
    columnMap.put(TEXT_COLUMN1,
        new Cell(VALUE, HConstants.LATEST_TIMESTAMP));
    RegExpRowFilter filter = new RegExpRowFilter(null, columnMap);
    Scanner scanner = table.getScanner(columns, HConstants.EMPTY_START_ROW, filter);
    int numFound = doScan(scanner, printValues);
    Assert.assertEquals(NUM_ROWS, numFound);
  }
View Full Code Here

    super.setUp();
   
    colvalues = new TreeMap<byte [], Cell>(Bytes.BYTES_COMPARATOR);
    for (char c = FIRST_CHAR; c < LAST_CHAR; c++) {
      colvalues.put(new byte [] {(byte)c},
          new Cell(GOOD_BYTES, HConstants.LATEST_TIMESTAMP));
    }
   
    Set<RowFilterInterface> filters = new HashSet<RowFilterInterface>();
    filters.add(new PageRowFilter(MAX_PAGES));
    filters.add(new RegExpRowFilter(".*regex.*", colvalues));
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.io.Cell$CellIterator

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.