Package org.apache.hadoop.hbase.client

Examples of org.apache.hadoop.hbase.client.Scan.addColumn()


  @Test
  public void testAvgWithInvalidRange() {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
    scan.setStartRow(ROWS[5]);
    scan.setStopRow(ROWS[1]);
    final ColumnInterpreter<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    Double avg = null;
    try {
View Full Code Here


  @Test
  public void testAvgWithFilter() 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<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    Double avg = null;
    avg = aClient.avg(TEST_TABLE, ci, scan);
View Full Code Here

   */
  @Test
  public void testStdWithValidRange() throws Throwable {
    AggregationClient aClient = new AggregationClient(conf);
    Scan scan = new Scan();
    scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
    final ColumnInterpreter<BigDecimal, BigDecimal> ci = new BigDecimalColumnInterpreter();
    double std = aClient.std(TEST_TABLE, ci, scan);
    assertEquals(5.766, std, 0.05d);
  }

View Full Code Here

   */
  @Test
  public void testStdWithValidRange2() 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();
    double std = aClient.std(TEST_TABLE, ci, scan);
    assertEquals(2.87, std, 0.05d);
View Full Code Here

      String value = (j % 10 == 0) ? "v1" : "v2";
      puts.add(createPut(rowkey, value));
    }
    ht.put(puts);
    Scan scan = new Scan ();
    scan.addColumn(FAMILY1, QUALIFIER2);
    // Delete the column cf1:col2
    long noOfRowsDeleted = invokeBulkDeleteProtocol(tableName, scan, 500, DeleteType.COLUMN, null);
    assertEquals(100, noOfRowsDeleted);

    int rows = 0;
View Full Code Here

      put.add(FAMILY1, QUALIFIER3, value);
      puts.add(put);
    }
    ht.put(puts);
    Scan scan = new Scan ();
    scan.addColumn(FAMILY1, QUALIFIER3);
    // Delete the column cf1:c3's one version at TS=1234
    long noOfRowsDeleted = invokeBulkDeleteProtocol(tableName, scan, 500, DeleteType.VERSION, 1234L);
    assertEquals(100, noOfRowsDeleted);
    int rows = 0;
    scan = new Scan ();
View Full Code Here

    ht.put(puts);
   
    // Delete all the versions of columns cf1:c1 and cf1:c2 falling with the time range
    // [1000,2000)
    final Scan scan = new Scan();
    scan.addColumn(FAMILY1, QUALIFIER1);
    scan.addColumn(FAMILY1, QUALIFIER2);
    scan.setTimeRange(1000L, 2000L);
    scan.setMaxVersions();
   
    long noOfDeletedRows = 0L;
View Full Code Here

   
    // Delete all the versions of columns cf1:c1 and cf1:c2 falling with the time range
    // [1000,2000)
    final Scan scan = new Scan();
    scan.addColumn(FAMILY1, QUALIFIER1);
    scan.addColumn(FAMILY1, QUALIFIER2);
    scan.setTimeRange(1000L, 2000L);
    scan.setMaxVersions();
   
    long noOfDeletedRows = 0L;
    long noOfVersionsDeleted = 0L;
View Full Code Here

   */
  @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

   */
  @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

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.