Package org.apache.hadoop.hbase.io

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


     * @return RowResult
     *
     * @see org.apache.hadoop.mapred.RecordReader#createValue()
     */
    public RowResult createValue() {
      return new RowResult();
    }
View Full Code Here


     * @throws IOException
     */
    @SuppressWarnings("unchecked")
    public boolean next(ImmutableBytesWritable key, RowResult value)
    throws IOException {
      RowResult result = this.scanner.next();
      boolean hasMore = result != null && result.size() > 0;
      if (hasMore) {
        key.set(result.getRow());
        Writables.copyWritable(result, value);
      }
      return hasMore;
    }
View Full Code Here

      Field.Store.YES, Field.Index.UN_TOKENIZED);
    keyField.setOmitNorms(true);
    doc.add(keyField);

    while (values.hasNext()) {
      RowResult value = values.next();

      // each column (name-value pair) is a field (name-value pair)
      for (Map.Entry<byte [], Cell> entry : value.entrySet()) {
        // name is already UTF-8 encoded
        String column = entry.getKey().toString();
        byte[] columnValue = entry.getValue().getValue();
        Field.Store store = indexConf.isStore(column)?
          Field.Store.YES: Field.Store.NO;
View Full Code Here

  }

  private void outputScannerEntryXML(final HttpServletResponse response,
    final ScannerRecord sr)
  throws IOException {
    RowResult rowResult = sr.next();
   
    // respond with a 200 and Content-type: text/xml
    setResponseHeader(response, 200, ContentType.XML.toString());
   
    // setup an xml outputter
    XMLOutputter outputter = getXMLOutputter(response.getWriter());
   
    outputter.startTag(ROW);
   
    // write the row key
    doElement(outputter, "name",
      org.apache.hadoop.hbase.util.Base64.encodeBytes(rowResult.getRow()));
   
    outputColumnsXml(outputter, rowResult);
    outputter.endTag();
    outputter.endDocument();
    outputter.getWriter().close();
View Full Code Here

      this.latestRegion = null;
    }
   
    private HRegionInfo nextRegion() throws IOException {
      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());
View Full Code Here

     */
    public RowResult next() throws IOException {
      if (!hasNext()) {
        return null;
      }
      RowResult temp = next;
      next = null;
      return temp;
    }
View Full Code Here

     * Check current row has a HRegionInfo.  Skip to next row if HRI is empty.
     * @return A Map of the row content else null if we are off the end.
     * @throws IOException
     */
    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;
View Full Code Here

      TransactionalRegion region = getTransactionalRegion(regionName);
      HbaseMapWritable<byte[], Cell> result = new HbaseMapWritable<byte[], Cell>();
      result.putAll(region.getFull(transactionId, row, columnSet, ts));
      LOG.debug("Got row ["+Bytes.toString(row)+"] in ["+((System.nanoTime()-startTime) / 1000)+"]micro seconds");
      return new RowResult(row, result);
    } catch (IOException e) {
      checkFileSystem();
      throw e;
    }
View Full Code Here

     * @return RowResult
     *
     * @see org.apache.hadoop.mapred.RecordReader#createValue()
     */
    public RowResult createValue() {
      return new RowResult();
    }
View Full Code Here

    return id;
  }

  public TransactionStatus getStatusForTransaction(long transactionId) {
    try {
      RowResult result = table.getRow(getRow(transactionId));
      if (result == null || result.isEmpty()) {
        return null;
      }
      Cell statusCell = result.get(STATUS_COLUMN_BYTES);
      if (statusCell == null) {
        throw new RuntimeException("No status cell for row " + transactionId);
      }
      String statusString = Bytes.toString(statusCell.getValue());
      return TransactionStatus.valueOf(statusString);
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.io.RowResult

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.