Examples of AggregationClient


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

  /**
   * @throws Throwable
   */
  @Test
  public void testMedianWithValidRange() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
    final ColumnInterpreter<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    BigDecimal median = aClient.median(TEST_TABLE, ci, scan);
    assertEquals(new BigDecimal("8.00"), median);
  }
View Full Code Here

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

   * give max for the entire table.
   * @throws Throwable
   */
  @Test
  public void testMax() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
    final ColumnInterpreter<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    BigDecimal maximum = aClient.max(TEST_TABLE, ci, scan);
    assertEquals(new BigDecimal("19.00"), maximum);
  }
View Full Code Here

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

  /**
   * @throws Throwable
   */
  @Test
  public void testMaxWithValidRange2() 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<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    BigDecimal max = aClient.max(TEST_TABLE, ci, scan);
    assertEquals(new BigDecimal("14.00"), max);
  }
View Full Code Here

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

    assertEquals(new BigDecimal("14.00"), max);
  }

  @Test
  public void testMaxWithValidRangeWithoutCQ() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addFamily(TEST_FAMILY);
    final ColumnInterpreter<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    BigDecimal maximum = aClient.max(TEST_TABLE, ci, scan);
    assertEquals(new BigDecimal("19.00"), maximum);
  }
View Full Code Here

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

    assertEquals(new BigDecimal("19.00"), maximum);
  }

  @Test
  public void testMaxWithValidRange2WithoutCQ() 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<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    BigDecimal max = aClient.max(TEST_TABLE, ci, scan);
    assertEquals(new BigDecimal("6.00"), max);
  }
View Full Code Here

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

    assertEquals(new BigDecimal("6.00"), max);
  }

  @Test
  public void testMaxWithValidRangeWithNullCF() {
    AggregationClient aClient = new AggregationClient(conf);
    final ColumnInterpreter<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    Scan scan = new Scan();
    BigDecimal max = null;
    try {
      max = aClient.max(TEST_TABLE, ci, scan);
    } catch (Throwable e) {
      max = null;
    }
    assertEquals(null, max);// 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 testMaxWithInvalidRange() {
    AggregationClient aClient = new AggregationClient(conf);
    final ColumnInterpreter<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    Scan scan = new Scan();
    scan.setStartRow(ROWS[4]);
    scan.setStopRow(ROWS[2]);
    scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
    BigDecimal max = new BigDecimal(Long.MIN_VALUE);
    ;
    try {
      max = aClient.max(TEST_TABLE, ci, scan);
    } catch (Throwable e) {
      max = BigDecimal.ZERO;
    }
    assertEquals(BigDecimal.ZERO, max);// control should go to the catch block
  }
View Full Code Here

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

    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
    scan.setStartRow(ROWS[4]);
    scan.setStopRow(ROWS[4]);
    try {
      AggregationClient aClient = new AggregationClient(conf);
      final ColumnInterpreter<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
      max = aClient.max(TEST_TABLE, ci, scan);
    } catch (Exception e) {
      max = BigDecimal.ZERO;
    }
    assertEquals(BigDecimal.ZERO, max);// control should go to the catch block
  }
View Full Code Here

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

  }

  @Test
  public void testMaxWithFilter() throws Throwable {
    BigDecimal max = BigDecimal.ZERO;
    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<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    max = aClient.max(TEST_TABLE, ci, scan);
    assertEquals(null, max);
  }
View Full Code Here

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

  /**
   * @throws Throwable
   */
  @Test
  public void testMinWithValidRange() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
    scan.setStartRow(HConstants.EMPTY_START_ROW);
    scan.setStopRow(HConstants.EMPTY_END_ROW);
    final ColumnInterpreter<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    BigDecimal min = aClient.min(TEST_TABLE, ci, scan);
    assertEquals(new BigDecimal("0.00"), min);
  }
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.