Examples of AggregationClient


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

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

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

    assertEquals(new BigDecimal("5.00"), min);
  }

  @Test
  public void testMinWithValidRangeWithNoCQ() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addFamily(TEST_FAMILY);
    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

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

    assertEquals(new BigDecimal("0.00"), min);
  }

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

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

    assertEquals(new BigDecimal("0.60"), min);
  }

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

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

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

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

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

        //scan.addColumn(b("CF"), b("AGE"));

        init();
        createTable();
        initHTable();
        ac = new AggregationClient(conf);

        ResultSet rs = stmt.executeQuery("select * from " + tableName + " where _rowkey_='RK" + startKey + "'");
        if (!rs.next())
            testHBaseBatch();

View Full Code Here

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<Long, Long> ci = new LongColumnInterpreter();
    long median = aClient.median(TEST_TABLE, ci,
        scan);
    assertEquals(8L, median);
  }
View Full Code Here

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

   * be the most common use case.
   * @throws Throwable
   */
  @Test
  public void testRowCountWithValidRange() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
    scan.setStartRow(ROWS[2]);
    scan.setStopRow(ROWS[14]);
    final ColumnInterpreter<Long, Long> ci = new LongColumnInterpreter();
    long rowCount = aClient.rowCount(TEST_TABLE, ci, scan);
    assertEquals(12, rowCount);
  }
View Full Code Here

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

   * be null.
   * @throws Throwable
   */
  @Test
  public void testRowCountAllTable() 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 rowCount = aClient.rowCount(TEST_TABLE, ci,
        scan);
    assertEquals(ROWSIZE, rowCount);
  }
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.