Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.Get


    long ts = 0;
    if (!tupleTimestampField.equals("")) {
      ts = tuple.getLongByField(tupleTimestampField);
    }

    Get g = new Get(rowKey);

    if (columnFamilies.size() > 0) {
      for (String cf : columnFamilies.keySet()) {
        byte[] cfBytes = Bytes.toBytes(cf);
        for (String cq : columnFamilies.get(cf)) {
          byte[] cqBytes = Bytes.toBytes(cq);
          g.addColumn(cfBytes, cqBytes);
          try {
            g.setMaxVersions(1);
          } catch (IOException e) {
            Log.error("Invalid number of versions", e);
          }
          if (ts > 0) {
            g.setTimeStamp(ts);
          }
        }
      }
    }
View Full Code Here


    try {
      HTable table = new HTable(config, info.tableName);
      Field id = ClassInfo.getIdField(clazz);
      id.setAccessible(true);
     
      Get g = new Get(Bytes.toBytes(id.get(obj).toString()));     
      Result rowResult = table.get(g);
      if(rowResult.isEmpty()) throw new SienaException("No such object");
      mapObject(clazz, obj, rowResult);
    } catch(Exception e) {
      throw new SienaException(e);
View Full Code Here

    }

    @Override
    public void execute(Tuple tuple) {
        byte[] rowKey = this.mapper.rowKey(tuple);
        Get get = hBaseClient.constructGetRequests(rowKey, projectionCriteria);

        try {
            Result result = hBaseClient.batchGet(Lists.newArrayList(get))[0];
            for(Values values : rowToTupleMapper.toValues(tuple, result)) {
                this.collector.emit(values);
View Full Code Here

        HTableInterface hTable = getHTable();
        byte[] key = randomRowKey();
        Put put = new Put(key);
        put.add(cf, key, key);
        hTable.put(put);
        Result result = hTable.get(new Get(key));

        // Make sure the Put made it into the DB and the Get got it back
        Assert.assertNotNull(result);
        Assert.assertArrayEquals(key, result.getColumnLatest(cf, key).getValue());
       
View Full Code Here

        byte[] row = randomRowKey();
        Put put = new Put(row);
        put.add(cf, row, row); // Just put anything, doesn't matter what
        hTable.put(put);
       
        Get get = new Get(row);
        Assert.assertTrue(hTable.exists(get));
       
        assertMetricsUpdated(OpType.EXISTS, OpType.PUT);
    }
View Full Code Here

        byte[] row = randomRowKey();
        Put put = new Put(row);
        put.add(cf, row, row); // put whatever, just write something into the row
        hTable.batch(ImmutableList.<Row>of(put));
       
        Get get = new Get(row);
        Assert.assertTrue(hTable.exists(get));
       
        assertMetricsUpdated(OpType.BATCH, OpType.EXISTS);
    }
View Full Code Here

        Put put = new Put(row);
        put.add(cf, row, row); // put whatever, just write something into the row
        hTable.batch(ImmutableList.<Row>of(put));
       
        Object[] results = new Result[1];
        Get get = new Get(row);
        hTable.batch(ImmutableList.<Row>of(get), results);
       
        Assert.assertArrayEquals(row, ((Result)(results[0])).getRow());
        assertMetricsUpdated(OpType.BATCH);
    }
View Full Code Here

        Put put2 = new Put(row2);
        put2.add(cf, row2, row2);
       
        hTable.batch(ImmutableList.<Row>of(put1, put2));
       
        List<Get> gets = ImmutableList.<Get>of(new Get(row1), new Get(row2));
        Result[] results = hTable.get(gets);

        Assert.assertArrayEquals(row1, results[0].getRow());
        Assert.assertArrayEquals(row2, results[1].getRow());
       
View Full Code Here

       Put newPut = new Put(row);
       byte[] randBytes = randomRowKey();
       newPut.add(cf, randBytes, randBytes);
       hTable.checkAndPut(row, cf, row, row, newPut);

       Result result = hTable.get(new Get(row));
       Assert.assertEquals(2, result.list().size());
      
       assertMetricsUpdated(OpType.PUT, OpType.CHECK_AND_PUT, OpType.GET);
   }
View Full Code Here

       put.add(cf, row, row);
       hTable.put(put);

       hTable.delete(new Delete(row));
      
       Assert.assertTrue(hTable.get(new Get(row)).isEmpty());
      
       assertMetricsUpdated(OpType.PUT, OpType.GET, OpType.DELETE);
   }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.client.Get

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.