Package org.apache.hadoop.hbase.client

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


    ClassInfo info = ClassInfo.getClassInfo(clazz);
    try {
      HTable table = new HTable(config, info.tableName);
      Field id = ClassInfo.getIdField(clazz);
      id.setAccessible(true);
      Delete d = new Delete(Bytes.toBytes(id.get(obj).toString()));
      table.delete(d);
    } catch(Exception e) {
      throw new SienaException(e);
    }
  }
View Full Code Here


        table.append(append);
      }
     
      if(del!=null)
      {
        Delete delete=new Delete(Bytes.toBytes(higo_uuid));
        for(Entry<String, Object> e:del.getMap().entrySet())
        {
          delete.deleteColumn(MdrillRealTimeHbaseImpl.DATA_FAMILY,  Bytes.toBytes(e.getKey()));
        }
       
        table.delete(delete);
      }
     
View Full Code Here

       byte[] row = randomRowKey();
       Put put = new Put(row);
       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

       rs.close();
       Assert.assertEquals(ROWS_TO_INSERT, countRows);
      
       List<Delete> deletes = new ArrayList<Delete>();
       for(byte[] row: rows) {
           deletes.add(new Delete(row));
       }
       hTable.delete(deletes);
      
       rs = hTable.getScanner(new Scan());
       countRows = 0;
View Full Code Here

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

       hTable.checkAndDelete(row, cf, row, row, new Delete(row));

       Assert.assertTrue(hTable.get(new Get(row)).isEmpty());
       assertMetricsUpdated(OpType.PUT, OpType.CHECK_AND_DELETE, OpType.GET);

   }
View Full Code Here

         List<Delete> batch = deleteBatches.get(rowkey.getTable());
         if (batch == null) {
            batch = new ArrayList<Delete>();
            deleteBatches.put(rowkey.getTable(), batch);
         }
         Delete delete = new Delete(rowkey.getRow());
         for (Entry<byte[], List<KeyValue>> entry : rowkey.getFamilies().entrySet()) {
            for (KeyValue kv : entry.getValue()) {
               delete.deleteColumn(entry.getKey(), kv.getQualifier(), transactionState.getStartTimestamp());
            }
         }
         batch.add(delete);
      }
      for (final Entry<byte[], List<Delete>> entry : deleteBatches.entrySet()) {
View Full Code Here

                            ByteBuffer row,
                            ByteBuffer column,
        long timestamp, Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
      try {
        HTable table = getTable(tableName);
        Delete delete  = new Delete(getBytes(row));
        addAttributes(delete, attributes);
        byte [][] famAndQf = KeyValue.parseColumn(getBytes(column));
        if (famAndQf.length == 1) {
          delete.deleteFamily(famAndQf[0], timestamp);
        } else {
          delete.deleteColumns(famAndQf[0], famAndQf[1], timestamp);
        }
        table.delete(delete);

      } catch (IOException e) {
        LOG.warn(e.getMessage(), e);
View Full Code Here

    public void deleteAllRowTs(
        ByteBuffer tableName, ByteBuffer row, long timestamp,
        Map<ByteBuffer, ByteBuffer> attributes) throws IOError {
      try {
        HTable table = getTable(tableName);
        Delete delete  = new Delete(getBytes(row), timestamp, null);
        addAttributes(delete, attributes);
        table.delete(delete);
      } catch (IOException e) {
        LOG.warn(e.getMessage(), e);
        throw new IOError(e.getMessage());
View Full Code Here

      try {
        table = getTable(tableName);
        Put put = new Put(getBytes(row), timestamp, null);
        addAttributes(put, attributes);

        Delete delete = new Delete(getBytes(row));
        addAttributes(delete, attributes);
        if (metrics != null) {
          metrics.incNumRowKeysInBatchMutate(mutations.size());
        }

        // I apologize for all this mess :)
        for (Mutation m : mutations) {
          byte[][] famAndQf = KeyValue.parseColumn(getBytes(m.column));
          if (m.isDelete) {
            if (famAndQf.length == 1) {
              delete.deleteFamily(famAndQf[0], timestamp);
            } else {
              delete.deleteColumns(famAndQf[0], famAndQf[1], timestamp);
            }
            delete.setWriteToWAL(m.writeToWAL);
          } else {
            if(famAndQf.length == 1) {
              put.add(famAndQf[0], HConstants.EMPTY_BYTE_ARRAY,
                  m.value != null ? getBytes(m.value)
                      : HConstants.EMPTY_BYTE_ARRAY);
            } else {
              put.add(famAndQf[0], famAndQf[1],
                  m.value != null ? getBytes(m.value)
                      : HConstants.EMPTY_BYTE_ARRAY);
            }
            put.setWriteToWAL(m.writeToWAL);
          }
        }
        if (!delete.isEmpty())
          table.delete(delete);
        if (!put.isEmpty())
          table.put(put);
      } catch (IOException e) {
        LOG.warn(e.getMessage(), e);
View Full Code Here

      List<Delete> deletes = new ArrayList<Delete>();

      for (BatchMutation batch : rowBatches) {
        byte[] row = getBytes(batch.row);
        List<Mutation> mutations = batch.mutations;
        Delete delete = new Delete(row);
        addAttributes(delete, attributes);
        Put put = new Put(row, timestamp, null);
        addAttributes(put, attributes);
        for (Mutation m : mutations) {
          byte[][] famAndQf = KeyValue.parseColumn(getBytes(m.column));
          if (m.isDelete) {
            // no qualifier, family only.
            if (famAndQf.length == 1) {
              delete.deleteFamily(famAndQf[0], timestamp);
            } else {
              delete.deleteColumns(famAndQf[0], famAndQf[1], timestamp);
            }
            delete.setWriteToWAL(m.writeToWAL);
          } else {
            if(famAndQf.length == 1) {
              put.add(famAndQf[0], HConstants.EMPTY_BYTE_ARRAY,
                  m.value != null ? getBytes(m.value)
                      : HConstants.EMPTY_BYTE_ARRAY);
            } else {
              put.add(famAndQf[0], famAndQf[1],
                  m.value != null ? getBytes(m.value)
                      : HConstants.EMPTY_BYTE_ARRAY);
            }
            put.setWriteToWAL(m.writeToWAL);
          }
        }
        if (!delete.isEmpty())
          deletes.add(delete);
        if (!put.isEmpty())
          puts.add(put);
      }
View Full Code Here

TOP

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

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.