Package org.apache.hadoop.hbase.io

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


            if(columnMatch(i)) {             
              // We only want the first result for any specific family member
              if(!results.containsKey(keys[i].getColumn())) {
                results.put(keys[i].getColumn(),
                    new Cell(vals[i], keys[i].getTimestamp()));
                insertedItem = true;
              }
            }

            if (!getNext(i)) {
View Full Code Here


        LOG.debug("get: table=" + new String(tableName) + ", row="
            + new String(row) + ", col=" + new String(column));
      }
      try {
        HTable table = getTable(tableName);
        Cell value = table.get(getText(row), getText(column));
        if (value == null) {
          throw new NotFound();
        }
        return value.getValue();
      } catch (IOException e) {
        throw new IOError(e.getMessage());
      }
    }
View Full Code Here

   */
  public static void changeOnlineStatus (final HBaseConfiguration c,
      final byte [] row, final boolean onlineOffline)
  throws IOException {
    HTable t = new HTable(c, HConstants.META_TABLE_NAME);
    Cell cell = t.get(row, HConstants.COL_REGIONINFO);
    if (cell == null) {
      throw new IOException("no information for row " + row);
    }
    // Throws exception if null.
    HRegionInfo info = Writables.getHRegionInfo(cell);
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

          } else if (!(deletes.containsKey(itCol)
              && deletes.get(itCol).longValue() >= itKey.getTimestamp())) {
            // Skip expired cells
            if (ttl == HConstants.FOREVER ||
                  now < itKey.getTimestamp() + ttl) {
              results.put(itCol, new Cell(val, itKey.getTimestamp()));
            } else {
              victims.add(itKey);
              if (LOG.isDebugEnabled()) {
                LOG.debug("internalGetFull: " + itKey + ": expired, skipped");
              }
View Full Code Here

      if (itKey.matchesRowCol(key)) {
        if (!HLogEdit.isDeleted(es.getValue())) {
          // Filter out expired results
          if (ttl == HConstants.FOREVER ||
                now < itKey.getTimestamp() + ttl) {
            result.add(new Cell(tailMap.get(itKey), itKey.getTimestamp()));
            if (numVersions > 0 && result.size() >= numVersions) {
              break;
            }
          } else {
            victims.add(itKey);
View Full Code Here

        key.setVersion(this.timestamp);
        getFull(key, isWildcardScanner() ? null : this.columns, deletes,
            rowResults);
        for (Map.Entry<byte [], Long> e: deletes.entrySet()) {
          rowResults.put(e.getKey(),
            new Cell(HLogEdit.deleteBytes.get(), e.getValue().longValue()));
        }
        for (Map.Entry<byte [], Cell> e: rowResults.entrySet()) {
          byte [] column = e.getKey();
          Cell c = e.getValue();
          if (isWildcardScanner()) {
            // Check the results match.  We only check columns, not timestamps.
            // We presume that timestamps have been handled properly when we
            // called getFull.
            if (!columnMatch(column)) {
              continue;
            }
          }
          // We should never return HConstants.LATEST_TIMESTAMP as the time for
          // the row. As a compromise, we return the largest timestamp for the
          // entries that we find that match.
          if (c.getTimestamp() != HConstants.LATEST_TIMESTAMP &&
              c.getTimestamp() > latestTimestamp) {
            latestTimestamp = c.getTimestamp();
          }
          results.put(column, c);
        }
        this.currentRow = getNextRow(this.currentRow);
View Full Code Here

      for (BatchOperation op : b) {
        if (!op.isPut()
            || (columns != null && !columnInColumns(op.getColumn(), columns))) {
          continue;
        }
        results.put(op.getColumn(), new Cell(op.getValue(), b.getTimestamp()));
      }
    }
    return results.size() == 0 ? null : results;
  }
View Full Code Here

      }
      for (BatchOperation op : b) {
        if (!op.isPut() || !Bytes.equals(column, op.getColumn())) {
          continue;
        }
        results.add(new Cell(op.getValue(), b.getTimestamp()));
      }
    }
    return results.size() == 0 ? null : results
        .toArray(new Cell[results.size()]);
  }
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.