Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.HTable.coprocessorExec()


  @Test
  public void testNullReturn() throws Throwable {
    HTable table = new HTable(util.getConfiguration(), TEST_TABLE);

    Map<byte[],String> results = table.coprocessorExec(PingProtocol.class,
        ROW_A, ROW_C,
        new Batch.Call<PingProtocol,String>(){
          public String call(PingProtocol instance) {
            return instance.hello("nobody");
          }
View Full Code Here


  @Test
  public void testVoidReturnType() throws Throwable {
    HTable table = new HTable(util.getConfiguration(), TEST_TABLE);

    Map<byte[],Object> results = table.coprocessorExec(PingProtocol.class,
        ROW_A, ROW_C,
        new Batch.Call<PingProtocol,Object>(){
          public Object call(PingProtocol instance) {
            instance.noop();
            return null;
View Full Code Here

        new Get(ROW_A), new Get(ROW_B), new Get(ROW_C));

    Batch.Call<PingProtocol,String> call =  Batch.forMethod(PingProtocol.class,
        "ping");
    Map<byte[],String> results =
        table.coprocessorExec(PingProtocol.class, ROW_A, ROW_C, call);


    verifyRegionResults(table, results, ROW_A);
    verifyRegionResults(table, results, ROW_B);
    verifyRegionResults(table, results, ROW_C);
View Full Code Here

    verifyRegionResults(table, results, ROW_C);

    Batch.Call<PingProtocol,String> helloCall =
      Batch.forMethod(PingProtocol.class, "hello", "NAME");
    results =
        table.coprocessorExec(PingProtocol.class, ROW_A, ROW_C, helloCall);


    verifyRegionResults(table, results, "Hello, NAME", ROW_A);
    verifyRegionResults(table, results, "Hello, NAME", ROW_B);
    verifyRegionResults(table, results, "Hello, NAME", ROW_C);
View Full Code Here

  @Test
  public void testRowRange() throws Throwable {
    HTable table = new HTable(util.getConfiguration(), TEST_TABLE);

    // test empty range
    Map<byte[],String> results = table.coprocessorExec(PingProtocol.class,
        null, null, new Batch.Call<PingProtocol,String>() {
          public String call(PingProtocol instance) {
            return instance.ping();
          }
        });
View Full Code Here

      public synchronized void update(byte[] region, byte[] row, R result) {
        max = (max == null || (result != null && ci.compare(max, result) < 0)) ? result : max;
      }
    }
    MaxCallBack aMaxCallBack = new MaxCallBack();
    table.coprocessorExec(AggregateProtocol.class, scan.getStartRow(), scan
        .getStopRow(), new Batch.Call<AggregateProtocol, R>() {
      @Override
      public R call(AggregateProtocol instance) throws IOException {
        return instance.getMax(ci, scan);
      }
View Full Code Here

        min = (min == null || (result != null && ci.compare(result, min) < 0)) ? result : min;
      }
    }
    HTable table = new HTable(conf, tableName);
    MinCallBack minCallBack = new MinCallBack();
    table.coprocessorExec(AggregateProtocol.class, scan.getStartRow(), scan
        .getStopRow(), new Batch.Call<AggregateProtocol, R>() {

      @Override
      public R call(AggregateProtocol instance) throws IOException {
        return instance.getMin(ci, scan);
View Full Code Here

        rowCountL.addAndGet(result.longValue());
      }
    }
    RowNumCallback rowNum = new RowNumCallback();
    HTable table = new HTable(conf, tableName);
    table.coprocessorExec(AggregateProtocol.class, scan.getStartRow(), scan
        .getStopRow(), new Batch.Call<AggregateProtocol, Long>() {
      @Override
      public Long call(AggregateProtocol instance) throws IOException {
        return instance.getRowNum(ci, scan);
      }
View Full Code Here

        sumVal = ci.add(sumVal, result);
      }
    }
    SumCallBack sumCallBack = new SumCallBack();
    HTable table = new HTable(conf, tableName);
    table.coprocessorExec(AggregateProtocol.class, scan.getStartRow(), scan
        .getStopRow(), new Batch.Call<AggregateProtocol, S>() {
      @Override
      public S call(AggregateProtocol instance) throws IOException {
        return instance.getSum(ci, scan);
      }
View Full Code Here

        rowCount += result.getSecond();
      }
    }
    AvgCallBack avgCallBack = new AvgCallBack();
    HTable table = new HTable(conf, tableName);
    table.coprocessorExec(AggregateProtocol.class, scan.getStartRow(), scan
        .getStopRow(), new Batch.Call<AggregateProtocol, Pair<S, Long>>() {
      @Override
      public Pair<S, Long> call(AggregateProtocol instance) throws IOException {
        return instance.getAvg(ci, scan);
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.