Package org.apache.hadoop.hbase.io

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


    batchUpdate2.put(COLUMN_FAMILY_STR,one);
   
    table.commit(batchUpdate);
    table.commit(batchUpdate2);
   
    RowResult result = null;
   
    // Test before first that null is returned
    result = table.getClosestRowBefore(beforeFirstRow, columnFamilyBytes);
    assertTrue(result == null);
   
    // Test at first that first is returned
    result = table.getClosestRowBefore(firstRow, columnFamilyBytes);
    assertTrue(result.containsKey(COLUMN_FAMILY_STR));
    assertTrue(Bytes.equals(result.get(COLUMN_FAMILY_STR).getValue(), zero));
   
    // Test inbetween first and second that first is returned
    result = table.getClosestRowBefore(beforeSecondRow, columnFamilyBytes);
    assertTrue(result.containsKey(COLUMN_FAMILY_STR));
    assertTrue(Bytes.equals(result.get(COLUMN_FAMILY_STR).getValue(), zero));
   
    // Test at second make sure second is returned
    result = table.getClosestRowBefore(row, columnFamilyBytes);
    assertTrue(result.containsKey(COLUMN_FAMILY_STR));
    assertTrue(Bytes.equals(result.get(COLUMN_FAMILY_STR).getValue(), one));
   
    // Test after second, make sure second is returned
    result = table.getClosestRowBefore(Bytes.add(row,one), columnFamilyBytes);
    assertTrue(result.containsKey(COLUMN_FAMILY_STR));
    assertTrue(Bytes.equals(result.get(COLUMN_FAMILY_STR).getValue(), one));
  }
View Full Code Here


   */
  public void testRowResult() throws Exception {
    HbaseMapWritable<byte [], Cell> m = new HbaseMapWritable<byte [], Cell>();
    byte [] b = Bytes.toBytes(getName());
    m.put(b, new Cell(b, System.currentTimeMillis()));
    RowResult rr = new RowResult(b, m);
    byte [] mb = Writables.getBytes(rr);
    RowResult deserializedRr =
      (RowResult)Writables.getWritable(mb, new RowResult());
    assertTrue(Bytes.equals(rr.getRow(), deserializedRr.getRow()));
    byte [] one = rr.get(b).getValue();
    byte [] two = deserializedRr.get(b).getValue();
    assertTrue(Bytes.equals(one, two));
    Writables.copyWritable(rr, deserializedRr);
    one = rr.get(b).getValue();
    two = deserializedRr.get(b).getValue();
    assertTrue(Bytes.equals(one, two));
   
  }
View Full Code Here

      Map<byte [], Cell> map = region.getFull(row, columnSet, ts,
          getLockFromId(lockId));
      HbaseMapWritable<byte [], Cell> result =
        new HbaseMapWritable<byte [], Cell>();
      result.putAll(map);
      return new RowResult(row, result);
    } catch (IOException e) {
      checkFileSystem();
      throw e;
    }
  }
View Full Code Here

    requestCount.incrementAndGet();
    try {
      // locate the region we're operating on
      HRegion region = getRegion(regionName);
      // ask the region for all the data
      RowResult rr = region.getClosestRowBefore(row);
      return rr;
    } catch (IOException e) {
      checkFileSystem();
      throw e;
    }
View Full Code Here

        }

        // No data for this row, go get another.
        results.clear();
      }
      return values.size() == 0 ? null : new RowResult(key.getRow(), values);
    } catch (IOException e) {
      checkFileSystem();
      throw e;
    }
  }
View Full Code Here

          }
         
          // if we get to here, then hasNext() has given us an item to return.
          // we want to return the item and then null out the next pointer, so
          // we use a temporary variable.
          RowResult temp = next;
          next = null;
          return temp;
        }

        public void remove() {
View Full Code Here

   
    if (!(rowResult instanceof RowResult)) {
      throw new SerDeException(getClass().getName() + ": expects RowResult!");
    }
   
    RowResult rr = (RowResult)rowResult;
    cachedHBaseRow.init(rr, hbaseColumnNames);
    return cachedHBaseRow;
  }
View Full Code Here

    cells.put(colbshort,   new Cell("456".getBytes(), 0));
    cells.put(colcint,     new Cell("789".getBytes(), 0));
    cells.put(colalong,    new Cell("1000".getBytes(), 0));
    cells.put(colbdouble,  new Cell("5.3".getBytes(), 0));
    cells.put(colcstring,  new Cell("hive and hadoop".getBytes(), 0));
    RowResult rr = new RowResult("test-row1".getBytes(), cells);
    BatchUpdate bu = new BatchUpdate("test-row1".getBytes());
    bu.put(colabyte,    "123".getBytes());
    bu.put(colbshort,   "456".getBytes());
    bu.put(colcint,     "789".getBytes());
    bu.put(colalong,    "1000".getBytes());
View Full Code Here

    cells.put("cfb:-1".getBytes(),   new Cell("".getBytes(), 0));
    cells.put("cfb:0".getBytes(),    new Cell("0".getBytes(), 0));
    cells.put("cfb:8".getBytes(),    new Cell("abc".getBytes(), 0));
    cells.put("cfc:col3".getBytes(), new Cell("cfccol3".getBytes(), 0));
       
    RowResult rr = new RowResult("test-row".getBytes(), cells);
       
    b.init(rr, "cfb:");
       
    assertEquals(
      new Text("def"),
View Full Code Here

    cells.put("cfb:-1".getBytes(),   new Cell("".getBytes(), 0));
    cells.put("cfb:0".getBytes(),    new Cell("0".getBytes(), 0));
    cells.put("cfb:8".getBytes(),    new Cell("abc".getBytes(), 0));
    cells.put("cfc:col3".getBytes(), new Cell("cfccol3".getBytes(), 0));
       
    RowResult rr = new RowResult("test-row".getBytes(), cells);
       
    b.init(rr, "cfb:");
       
    assertEquals(
      new Text("d\tf"),
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.