Package org.apache.hadoop.hbase.client

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


              RowMutations rm = new RowMutations(row);
              if (op) {
                Put p = new Put(row, ts);
                p.add(fam1, qual1, value1);
                rm.add(p);
                Delete d = new Delete(row);
                d.deleteColumns(fam1, qual2, ts);
                rm.add(d);
              } else {
                Delete d = new Delete(row);
                d.deleteColumns(fam1, qual1, ts);
                rm.add(d);
                Put p = new Put(row, ts);
                p.add(fam1, qual2, value2);
                rm.add(p);
              }
View Full Code Here


              List<Mutation> mrm = new ArrayList<Mutation>();
              if (op) {
                Put p = new Put(row2, ts);
                p.add(fam1, qual1, value1);
                mrm.add(p);
                Delete d = new Delete(row);
                d.deleteColumns(fam1, qual1, ts);
                mrm.add(d);
              } else {
                Delete d = new Delete(row2);
                d.deleteColumns(fam1, qual1, ts);
                mrm.add(d);
                Put p = new Put(row, ts);
                p.add(fam1, qual1, value2);
                mrm.add(p);
              }
View Full Code Here

            }
            region.put(put);
            numPutsFinished++;
            if (numPutsFinished > 0 && numPutsFinished % 47 == 0) {
              System.out.println("put iteration = " + numPutsFinished);
              Delete delete = new Delete(row, (long) numPutsFinished - 30);
              region.delete(delete);
            }
            numPutsFinished++;
          }
        } catch (InterruptedIOException e) {
View Full Code Here

    Scan scan = new Scan();
    scan.setMaxVersions(3);
    // open the first scanner
    RegionScanner scanner1 = region.getScanner(scan);

    Delete delete = new Delete(Bytes.toBytes("r1"));
    region.delete(delete);
    region.flushcache();

    // open the second scanner
    RegionScanner scanner2 = region.getScanner(scan);
View Full Code Here

      more = scanner.next(results);
      if (results != null && !results.isEmpty())
        count++;
      else
        break;
      Delete delete = new Delete(CellUtil.cloneRow(results.get(0)));
      delete.deleteColumn(Bytes.toBytes("trans-tags"), Bytes.toBytes("qual2"));
      r.delete(delete);
      results.clear();
    } while (more);
    assertEquals("Did not perform correct number of deletes", 3, count);
  }
View Full Code Here

      // not empty anymore
      res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(emptyVal),
          put, true);
      assertFalse(res);

      Delete delete = new Delete(row1);
      delete.deleteColumn(fam1, qf1);
      res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(emptyVal),
          delete, true);
      assertFalse(res);

      put = new Put(row1);
      put.add(fam1, qf1, val2);
      // checkAndPut with correct value
      res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(val1),
          put, true);
      assertTrue(res);

      // checkAndDelete with correct value
      delete = new Delete(row1);
      delete.deleteColumn(fam1, qf1);
      delete.deleteColumn(fam1, qf1);
      res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(val2),
          delete, true);
      assertTrue(res);

      delete = new Delete(row1);
      res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(emptyVal),
          delete, true);
      assertTrue(res);

      // checkAndPut looking for a null value
View Full Code Here

      boolean res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(
          val2), put, true);
      assertEquals(false, res);

      // checkAndDelete with wrong value
      Delete delete = new Delete(row1);
      delete.deleteFamily(fam1);
      res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(val2),
          delete, true);
      assertEquals(false, res);
    } finally {
      HRegion.closeHRegion(this.region);
View Full Code Here

      boolean res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(
          val1), put, true);
      assertEquals(true, res);

      // checkAndDelete with correct value
      Delete delete = new Delete(row1);
      delete.deleteColumn(fam1, qf1);
      res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(val1),
          put, true);
      assertEquals(true, res);
    } finally {
      HRegion.closeHRegion(this.region);
View Full Code Here

      put.add(fam2, qf3, val1);
      put.add(fam1, qf3, val1);
      region.put(put);

      // Multi-column delete
      Delete delete = new Delete(row1);
      delete.deleteColumn(fam1, qf1);
      delete.deleteColumn(fam2, qf1);
      delete.deleteColumn(fam1, qf3);
      boolean res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(
          val2), delete, true);
      assertEquals(true, res);

      Get get = new Get(row1);
      get.addColumn(fam1, qf1);
      get.addColumn(fam1, qf3);
      get.addColumn(fam2, qf2);
      Result r = region.get(get);
      assertEquals(2, r.size());
      assertArrayEquals(val1, r.getValue(fam1, qf1));
      assertArrayEquals(val2, r.getValue(fam2, qf2));

      // Family delete
      delete = new Delete(row1);
      delete.deleteFamily(fam2);
      res = region.checkAndMutate(row1, fam2, qf1, CompareOp.EQUAL, new BinaryComparator(emptyVal),
          delete, true);
      assertEquals(true, res);

      get = new Get(row1);
      r = region.get(get);
      assertEquals(1, r.size());
      assertArrayEquals(val1, r.getValue(fam1, qf1));

      // Row delete
      delete = new Delete(row1);
      res = region.checkAndMutate(row1, fam1, qf1, CompareOp.EQUAL, new BinaryComparator(val1),
          delete, true);
      assertEquals(true, res);
      get = new Get(row1);
      r = region.get(get);
View Full Code Here

    this.region = initHRegion(tableName, method, conf, fam1);
    try {
      region.put(put);

      // We do support deleting more than 1 'latest' version
      Delete delete = new Delete(row1);
      delete.deleteColumn(fam1, qual);
      delete.deleteColumn(fam1, qual);
      region.delete(delete);

      Get get = new Get(row1);
      get.addFamily(fam1);
      Result r = region.get(get);
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.