Package org.hbase.async

Examples of org.hbase.async.PutRequest


  /** Write a few KVs and delete them in one batch */
  @Test
  public void multiDelete() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    final PutRequest put2 = new PutRequest(table, "mdk1", family, "q2", "val2");
    client.put(put2).join();
    final PutRequest put3 = new PutRequest(table, "mdk2", family, "q3", "val3");
    client.put(put3).join();
    final PutRequest put1 = new PutRequest(table, "mdk1", family, "q1", "val1");
    client.put(put1).join();
    final DeleteRequest del2 = new DeleteRequest(table, "mdk1", family, "q2");
    final DeleteRequest del3 = new DeleteRequest(table, "mdk2", family, "q3");
    final DeleteRequest del1 = new DeleteRequest(table, "mdk1", family, "q1");
    Deferred.group(client.delete(del2), client.delete(del3),
View Full Code Here


    client.setFlushInterval(FAST_FLUSH);
    final String table1 = args[0] + "1";
    final String table2 = args[0] + "2";
    createOrTruncateTable(client, table1, family);
    createOrTruncateTable(client, table2, family);
    final PutRequest put2 = new PutRequest(table1, "mdk1", family, "q2", "val2");
    client.put(put2).join();
    final PutRequest put3 = new PutRequest(table1, "mdk2", family, "q3", "val3");
    client.put(put3).join();
    final PutRequest put1 = new PutRequest(table2, "mdk1", family, "q1", "val1");
    client.put(put1).join();
    final DeleteRequest del2 = new DeleteRequest(table1, "mdk1", family, "q2");
    final DeleteRequest del3 = new DeleteRequest(table1, "mdk2", family, "q3");
    final DeleteRequest del1 = new DeleteRequest(table2, "mdk1", family, "q1");
    Deferred.group(client.delete(del2), client.delete(del3),
View Full Code Here

  /** Attempt to write a column family that doesn't exist. */
  @Test
  public void putNonexistentFamily() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    final PutRequest put = new PutRequest(table, "k", family + family,
                                          "q", "val");
    try {
      client.put(put).join();
    } catch (NoSuchColumnFamilyException e) {
      assertEquals(put, e.getFailedRpc());
View Full Code Here

  /** Send a bunch of edits with one that references a non-existent family. */
  @Test
  public void multiPutWithOneBadRpcInBatch() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    final PutRequest put1 = new PutRequest(table, "mk1", family, "m1", "mpb1");
    // The following edit is destined to a non-existent family.
    final PutRequest put2 = new PutRequest(table, "mk2", family + family,
                                           "m2", "mpb2");
    final PutRequest put3 = new PutRequest(table, "mk3", family, "m3", "mpb3");
    try {
      final ArrayList<Deferred<Object>> ds = new ArrayList<Deferred<Object>>(3);
      ds.add(client.put(put1));
      ds.add(client.put(put2));
      ds.add(client.put(put3));
View Full Code Here

  /** Test regexp-based row key filtering.  */
  @Test
  public void keyRegexpFilter() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    final PutRequest put1 = new PutRequest(table, "krf accept:by the filter",
                                           family, "q", "krfv1");
    final PutRequest put2 = new PutRequest(table, "krf filtered out",
                                           family, "q", "krfv2");
    final PutRequest put3 = new PutRequest(table, "krf this is Accepted too",
                                           family, "q", "krfv3");
    Deferred.group(client.put(put1), client.put(put2),
                   client.put(put3)).join();
    final Scanner scanner = client.newScanner(table);
    scanner.setFamily(family);
View Full Code Here

  /** Simple column prefix filter tests.  */
  @Test
  public void columnPrefixFilter() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    // Keep only rows with a column qualifier that starts with "qa".
    final PutRequest put1 = new PutRequest(table, "cpf1", family, "qa1", "v1");
    final PutRequest put2 = new PutRequest(table, "cpf1", family, "qa2", "v2");
    final PutRequest put3 = new PutRequest(table, "cpf2", family, "qa3", "v3");
    final PutRequest put4 = new PutRequest(table, "cpf2", family, "qb4", "v4");
    Deferred.group(Deferred.group(client.put(put1), client.put(put2)),
                   Deferred.group(client.put(put3), client.put(put4))).join();
    final Scanner scanner = client.newScanner(table);
    scanner.setFamily(family);
    scanner.setStartKey("cpf1");
View Full Code Here

  @Test
  public void columnRangeFilter() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    // Keep rows that have a qualifier in between "qb" (inclusive) and "qd4"
    // (exclusive).  So only v2 and v3 should be returned by the scanner.
    final PutRequest put1 = new PutRequest(table, "crf1", family, "qa1", "v1");
    final PutRequest put2 = new PutRequest(table, "crf1", family, "qb2", "v2");
    final PutRequest put3 = new PutRequest(table, "crf2", family, "qc3", "v3");
    final PutRequest put4 = new PutRequest(table, "crf2", family, "qd4", "v4");
    Deferred.group(Deferred.group(client.put(put1), client.put(put2)),
                   Deferred.group(client.put(put3), client.put(put4))).join();
    final Scanner scanner = client.newScanner(table);
    scanner.setFamily(family);
    scanner.setStartKey("crf1");
View Full Code Here

  }

  @Test
  public void filterComparators() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    final PutRequest put1 = new PutRequest(table, "fc1", family, "a", "v1");
    final PutRequest put2 = new PutRequest(table, "fc2", family, "a", "v2");
    final PutRequest put3 = new PutRequest(table, "fc3", family, "a", "v3");
    Deferred.group(client.put(put1), client.put(put2), client.put(put3)).join();

    final Scanner binary_scanner = client.newScanner(table);
    binary_scanner.setStartKey("fc1");
    binary_scanner.setStopKey("fc4");
View Full Code Here

  }

  @Test
  public void compareFilters() throws Exception {
    client.setFlushInterval(FAST_FLUSH);
    final PutRequest put1 = new PutRequest(table, "cf1", family, "a", "v1");
    final PutRequest put2 = new PutRequest(table, "cf2", family, "b", "v2");
    final PutRequest put3 = new PutRequest(
        Bytes.UTF8(table),
        Bytes.UTF8("cf3"),
        Bytes.UTF8(family),
        Bytes.UTF8("c"),
        Bytes.UTF8("v3"),
        42);
    final PutRequest put4 = new PutRequest(
        Bytes.UTF8(table),
        Bytes.UTF8("cf3"),
        Bytes.UTF8(family),
        Bytes.UTF8("dep"),
        Bytes.UTF8("v4"),
View Full Code Here

    //   - a qualifier in between "qb" (inclusive) and "qd4" (exclusive).
    final ArrayList<ScanFilter> filters = new ArrayList<ScanFilter>(2);
    filters.add(new ColumnRangeFilter("qb", true, "qd4", false));
    filters.add(new KeyRegexpFilter("fl[12]$"));
    // Filtered out as we're looking due to qualifier being out of range:
    final PutRequest put1 = new PutRequest(table, "fl1", family, "qa1", "v1");
    // Kept by the filter:
    final PutRequest put2 = new PutRequest(table, "fl1", family, "qb2", "v2");
    // Filtered out because the row key doesn't match the regexp:
    final PutRequest put3 = new PutRequest(table, "fl1a", family, "qb3", "v3");
    // Kept by the filter:
    final PutRequest put4 = new PutRequest(table, "fl2", family, "qc4", "v4");
    // Filtered out because the qualifier is on the exclusive upper bound:
    final PutRequest put5 = new PutRequest(table, "fl2", family, "qd5", "v5");
    // Filtered out because the qualifier is past the upper bound:
    final PutRequest put6 = new PutRequest(table, "fl2", family, "qd6", "v6");
    Deferred.group(Deferred.group(client.put(put1), client.put(put2),
                                  client.put(put3)),
                   Deferred.group(client.put(put4), client.put(put5),
                                  client.put(put6))).join();
    final Scanner scanner = client.newScanner(table);
View Full Code Here

TOP

Related Classes of org.hbase.async.PutRequest

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.