Package org.apache.hadoop.hbase.io

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


    } catch (InterruptedException e) {
      // ignore
    }
   
    for(int i = 0; i < testKeys.length; i++) {
      Cell value = table.get(testKeys[i], CONTENTS);
      if(value != null && value.getValue().length != 0) {
        LOG.error("non existant key: " + testKeys[i] + " returned value: " +
            new String(value.getValue(), HConstants.UTF8_ENCODING));
        fail();
      }
    }
   
    for (int i = 0; i < rows.length; i++) {
      Cell value = table.get(rows[i], CONTENTS);
      if (value == null || value.getValue().length == 0) {
        LOG.error("No value returned for row " + Bytes.toString(rows[i]));
        fail();
      }
    }
    } catch (Exception e) {
View Full Code Here


          get.addFamily(family);
        } else {
          get.addColumn(family, qualifier);
        }
        Result result = table.get(get);
        Cell cell = result.getCellValue(family, qualifier);
        return ThriftUtilities.cellFromHBase(cell);
      } catch (IOException e) {
        throw new IOError(e.getMessage());
      }
    }
View Full Code Here

        get.setMaxVersions(numVersions);
        Result result = table.get(get);
        List<Cell> cells = new ArrayList<Cell>();
  if ( ! result.isEmpty() ) {
      for(KeyValue kv : result.sorted()) {
    cells.add(new Cell(kv.getValue(), kv.getTimestamp()));
      }
  }
        return ThriftUtilities.cellFromHBase(cells.toArray(new Cell[0]));
      } catch (IOException e) {
        throw new IOError(e.getMessage());
View Full Code Here

  List<Cell> cells = new ArrayList<Cell>();
  if ( ! result.isEmpty() ) {
      KeyValue [] kvs = result.sorted();
      if (kvs != null) {
    for(KeyValue kv : kvs) {
        cells.add(new Cell(kv.getValue(), kv.getTimestamp()));
    }
      }
        }
        return ThriftUtilities.cellFromHBase(cells.toArray(new Cell[0]));
      } catch (IOException e) {
View Full Code Here

        getRegionServerWithRetries(s);
        currentRegion = s.getHRegionInfo();
        try {
          RowResult r = null;
          while (result && (r = getRegionServerWithRetries(s)) != null) {
            Cell c = r.get(HConstants.COL_REGIONINFO);
            if (c != null) {
              byte[] value = c.getValue();
              if (value != null) {
                HRegionInfo info = Writables.getHRegionInfoOrNull(value);
                if (info != null) {
                  if (Bytes.equals(info.getTableDesc().getName(), tableName)) {
                    rowsScanned += 1;
View Full Code Here

        getRegionServerWithRetries(s);
        currentRegion = s.getHRegionInfo();
        try {
          RowResult r = null;
          while ((r = getRegionServerWithRetries(s)) != null) {
            Cell c = r.get(HConstants.COL_REGIONINFO);
            if (c != null) {
              HRegionInfo info = Writables.getHRegionInfoOrNull(c.getValue());
              if (info != null) {
                if (Bytes.equals(info.getTableDesc().getName(), tableName)) {
                  result = new UnmodifyableHTableDescriptor(info.getTableDesc());
                  break;
                }
View Full Code Here

          if (regionInfoRow == null) {
            throw new TableNotFoundException(Bytes.toString(tableName));
          }

          Cell value = regionInfoRow.get(COL_REGIONINFO);

          if (value == null || value.getValue().length == 0) {
            throw new IOException("HRegionInfo was null or empty in " +
              Bytes.toString(parentTable));
          }

          // convert the row result into the HRegionLocation we need!
          HRegionInfo regionInfo = (HRegionInfo) Writables.getWritable(
              value.getValue(), new HRegionInfo());

          // possible we got a region of a different table...
          if (!Bytes.equals(regionInfo.getTableDesc().getName(), tableName)) {
            throw new TableNotFoundException(
              "Table '" + Bytes.toString(tableName) + "' was not found.");
View Full Code Here

            // there aren't any pending deletes.
            if (!(deletes.containsKey(readcol) &&
                deletes.get(readcol).longValue() >= readkey.getTimestamp())) {
              if (!isExpired(readkey, ttl, now)) {
                results.put(readcol,
                  new Cell(readval.get(), readkey.getTimestamp()));
                // need to reinstantiate the readval so we can reuse it,
                // otherwise next iteration will destroy our result
                readval = new ImmutableBytesWritable();
              }
            }
View Full Code Here

          if (!readkey.matchesRowCol(key)) {
            continue;
          }
          if (!isDeleted(readkey, readval.get(), true, deletes)) {
            if (!isExpired(readkey, ttl, now)) {
              results.add(new Cell(readval.get(), readkey.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(numVersions, results)) {
              break;
            }
          }
          for (readval = new ImmutableBytesWritable();
              map.next(readkey, readval) &&
              readkey.matchesRowCol(key) &&
              !hasEnoughVersions(numVersions, results);
              readval = new ImmutableBytesWritable()) {
            if (!isDeleted(readkey, readval.get(), true, deletes)) {
              if (!isExpired(readkey, ttl, now)) {
                results.add(new Cell(readval.get(), readkey.getTimestamp()));
              }
            }
          }
        }
        if (hasEnoughVersions(numVersions, results)) {
View Full Code Here

        if (!(Bytes.equals(info.getTableDesc().getName(), getTableName()))) {
          return false;
        }

        HServerAddress server = new HServerAddress();
        Cell c = rowResult.get(HConstants.COL_SERVER);
        if (c != null && c.getValue() != null && c.getValue().length > 0) {
          String address = Bytes.toString(c.getValue());
          server = new HServerAddress(address);
        }
       
        if (!(info.isOffline() || info.isSplit())) {
          regionMap.put(new UnmodifyableHRegionInfo(info), server);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.io.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.