Examples of AggregationClient


Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient

    assertEquals(null, min);// control should go to the catch block
  }

  @Test
  public void testMinWithFilter() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
    Filter f = new PrefixFilter(Bytes.toBytes("foo:bar"));
    scan.setFilter(f);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    Long min = null;
    min = aClient.min(TEST_TABLE, ci, scan);
    assertEquals(null, min);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient

  /**
   * @throws Throwable
   */
  @Test
  public void testSumWithValidRange() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY,TEST_QUALIFIER);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    long sum = aClient.sum(TEST_TABLE, ci,
        scan);
    assertEquals(190, sum);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient

  /**
   * @throws Throwable
   */
  @Test
  public void testSumWithValidRange2() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY,TEST_QUALIFIER);
    scan.setStartRow(ROWS[5]);
    scan.setStopRow(ROWS[15]);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    long sum = aClient.sum(TEST_TABLE, ci, scan);
    assertEquals(95, sum);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient

    assertEquals(95, sum);
  }

  @Test
  public void testSumWithValidRangeWithNoCQ() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addFamily(TEST_FAMILY);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    long sum = aClient.sum(TEST_TABLE, ci,
        scan);
    assertEquals(190 + 1900, sum);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient

    assertEquals(190 + 1900, sum);
  }

  @Test
  public void testSumWithValidRange2WithNoCQ() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addFamily(TEST_FAMILY);
    scan.setStartRow(ROWS[6]);
    scan.setStopRow(ROWS[7]);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    long sum = aClient.sum(TEST_TABLE, ci, scan);
    assertEquals(6 + 60, sum);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient

    assertEquals(6 + 60, sum);
  }

  @Test
  public void testSumWithValidRangeWithNullCF() {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.setStartRow(ROWS[6]);
    scan.setStopRow(ROWS[7]);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    Long sum = null;
    try {
      sum = aClient.sum(TEST_TABLE, ci, scan);
    } catch (Throwable e) {
    }
    assertEquals(null, sum);// CP will throw an IOException about the
    // null column family, and max will be set to 0
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient

    // null column family, and max will be set to 0
  }

  @Test
  public void testSumWithInvalidRange() {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addFamily(TEST_FAMILY);
    scan.setStartRow(ROWS[6]);
    scan.setStopRow(ROWS[2]);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    Long sum = null;
    try {
      sum = aClient.sum(TEST_TABLE, ci, scan);
    } catch (Throwable e) {
    }
    assertEquals(null, sum);// control should go to the catch block
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient

    assertEquals(null, sum);// control should go to the catch block
  }

  @Test
  public void testSumWithFilter() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Filter f = new PrefixFilter(Bytes.toBytes("foo:bar"));
    Scan scan = new Scan();
    scan.addFamily(TEST_FAMILY);
    scan.setFilter(f);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    Long sum = null;
    sum = aClient.sum(TEST_TABLE, ci, scan);
    assertEquals(null, sum);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient

  /**
   * @throws Throwable
   */
  @Test
  public void testAvgWithValidRange() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY,TEST_QUALIFIER);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    double avg = aClient.avg(TEST_TABLE, ci,
        scan);
    assertEquals(9.5, avg, 0);
  }
View Full Code Here

Examples of org.apache.hadoop.hbase.client.coprocessor.AggregationClient

  /**
   * @throws Throwable
   */
  @Test
  public void testAvgWithValidRange2() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY,TEST_QUALIFIER);
    scan.setStartRow(ROWS[5]);
    scan.setStopRow(ROWS[15]);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    double avg = aClient.avg(TEST_TABLE, ci, scan);
    assertEquals(9.5, avg, 0);
  }
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.