Java 类org.apache.hadoop.hbase.client.coprocessor.AggregationClient 实例源码
项目:ditb
文件:TestAggregateProtocol.java
/**
* This will test the row count with startrow > endrow. The result should be
* -1.
* @throws Throwable
*/
@Test (timeout=300000)
public void testRowCountWithInvalidRange1() {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[2]);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long rowCount = -1;
try {
rowCount = aClient.rowCount(TEST_TABLE, ci, scan);
} catch (Throwable e) {
myLog.error("Exception thrown in the invalidRange method"
+ e.getStackTrace());
}
assertEquals(-1, rowCount);
}
项目:ditb
文件:TestAggregateProtocol.java
/**
* This will test the row count with startrow = endrow and they will be
* non-null. The result should be 0, as it assumes a non-get query.
* @throws Throwable
*/
@Test (timeout=300000)
public void testRowCountWithInvalidRange2() {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[5]);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long rowCount = -1;
try {
rowCount = aClient.rowCount(TEST_TABLE, ci, scan);
} catch (Throwable e) {
rowCount = 0;
}
assertEquals(0, rowCount);
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
public void testMaxWithInvalidRange() {
AggregationClient aClient = new AggregationClient(conf);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
Scan scan = new Scan();
scan.setStartRow(ROWS[4]);
scan.setStopRow(ROWS[2]);
scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
long max = Long.MIN_VALUE;
try {
max = aClient.max(TEST_TABLE, ci, scan);
} catch (Throwable e) {
max = 0;
}
assertEquals(0, max);// control should go to the catch block
}
项目:ditb
文件:TestDoubleColumnInterpreter.java
@Test(timeout = 300000)
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<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci =
new DoubleColumnInterpreter();
Double sum = null;
try {
sum = aClient.sum(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, sum);// control should go to the catch block
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
public void testMinWithValidRangeWithNullCF() {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[15]);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
Long 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
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
public void testMinWithInvalidRange() {
AggregationClient aClient = new AggregationClient(conf);
Long min = null;
Scan scan = new Scan();
scan.addFamily(TEST_FAMILY);
scan.setStartRow(ROWS[4]);
scan.setStopRow(ROWS[2]);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
try {
min = aClient.min(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, min);// control should go to the catch block
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
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<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
Long min = null;
try {
min = aClient.min(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, min);// control should go to the catch block
}
项目:ditb
文件:TestDoubleColumnInterpreter.java
@Test(timeout = 300000)
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<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci =
new DoubleColumnInterpreter();
Double avg = null;
try {
avg = aClient.avg(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, avg);// control should go to the catch block
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
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<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
Double avg = null;
try {
avg = aClient.avg(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, avg);// control should go to the catch block
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
public void testStdWithValidRangeWithNullCF() {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[17]);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
Double std = null;
try {
std = aClient.std(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, std);// CP will throw an IOException about the
// null column family, and max will be set to 0
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
public void testStdWithInvalidRange() {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.addFamily(TEST_FAMILY);
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[1]);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
Double std = null;
try {
std = aClient.std(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, std);// control should go to the catch block
}
项目:ditb
文件:TestBigDecimalColumnInterpreter.java
@Test (timeout=300000)
public void testMaxWithInvalidRange() {
AggregationClient aClient = new AggregationClient(conf);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> 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
}
项目:ditb
文件:TestBigDecimalColumnInterpreter.java
@Test (timeout=300000)
public void testMinWithValidRangeWithNullCF() {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[15]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> 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
}
项目:ditb
文件:TestBigDecimalColumnInterpreter.java
@Test (timeout=300000)
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, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
try {
min = aClient.min(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, min);// control should go to the catch block
}
项目:ditb
文件:TestBigDecimalColumnInterpreter.java
@Test (timeout=300000)
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, EmptyMsg, BigDecimalMsg, BigDecimalMsg> 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
}
项目:ditb
文件:TestBigDecimalColumnInterpreter.java
@Test (timeout=300000)
public void testSumWithValidRangeWithNullCF() {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[7]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
BigDecimal 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
}
项目:ditb
文件:TestBigDecimalColumnInterpreter.java
@Test (timeout=300000)
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<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
BigDecimal sum = null;
try {
sum = aClient.sum(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, sum);// control should go to the catch block
}
项目:ditb
文件:TestBigDecimalColumnInterpreter.java
@Test (timeout=300000)
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, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
Double avg = null;
try {
avg = aClient.avg(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, avg);// control should go to the catch block
}
项目:ditb
文件:TestBigDecimalColumnInterpreter.java
@Test (timeout=300000)
public void testStdWithValidRangeWithNullCF() {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[17]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
Double std = null;
try {
std = aClient.std(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, std);// CP will throw an IOException about the
// null column family, and max will be set to 0
}
项目:ditb
文件:TestBigDecimalColumnInterpreter.java
@Test
public void testStdWithInvalidRange() {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.addFamily(TEST_FAMILY);
scan.setStartRow(ROWS[6]);
scan.setStopRow(ROWS[1]);
final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci =
new BigDecimalColumnInterpreter();
Double std = null;
try {
std = aClient.std(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, std);// control should go to the catch block
}
项目:ditb
文件:TestDoubleColumnInterpreter.java
@Test(timeout = 300000)
public void testMaxWithInvalidRange() {
AggregationClient aClient = new AggregationClient(conf);
final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci =
new DoubleColumnInterpreter();
Scan scan = new Scan();
scan.setStartRow(ROWS[4]);
scan.setStopRow(ROWS[2]);
scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
double max = Double.MIN_VALUE;
;
try {
max = aClient.max(TEST_TABLE, ci, scan);
} catch (Throwable e) {
max = 0.00;
}
assertEquals(0.00, max, 0.00);// control should go to the catch block
}
项目:ditb
文件:TestDoubleColumnInterpreter.java
@Test(timeout = 300000)
public void testMaxWithInvalidRange2() throws Throwable {
double max = Double.MIN_VALUE;
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<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci =
new DoubleColumnInterpreter();
max = aClient.max(TEST_TABLE, ci, scan);
} catch (Exception e) {
max = 0.00;
}
assertEquals(0.00, max, 0.00);// control should go to the catch block
}
项目:ditb
文件:TestDoubleColumnInterpreter.java
@Test(timeout = 300000)
public void testMinWithValidRangeWithNullCF() {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.setStartRow(ROWS[5]);
scan.setStopRow(ROWS[15]);
final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci =
new DoubleColumnInterpreter();
Double min = null;
try {
min = aClient.min(TEST_TABLE, ci, scan);
} catch (Throwable e) {
min = null;
}
assertEquals(null, min);// CP will throw an IOException about the
// null column family, and min will be set to 0
}
项目:ditb
文件:TestDoubleColumnInterpreter.java
@Test(timeout = 300000)
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<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci =
new DoubleColumnInterpreter();
Double min = null;
try {
min = aClient.min(TEST_TABLE, ci, scan);
} catch (Throwable e) {
}
assertEquals(null, min);// control should go to the catch block
}
项目:ditb
文件:TestAggregateProtocol.java
/**
* @throws Throwable
*/
@Test (timeout=300000)
public void testMedianWithValidRange() throws Throwable {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.addColumn(TEST_FAMILY,TEST_QUALIFIER);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long median = aClient.median(TEST_TABLE, ci,
scan);
assertEquals(8L, median);
}
项目:ditb
文件:TestAggregateProtocol.java
/**
* This will test rowcount with a valid range, i.e., a subset of rows. It will
* be the most common use case.
* @throws Throwable
*/
@Test (timeout=300000)
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, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long rowCount = aClient.rowCount(TEST_TABLE, ci, scan);
assertEquals(12, rowCount);
}
项目:ditb
文件:TestAggregateProtocol.java
/**
* This will test the row count on the entire table. Startrow and endrow will
* be null.
* @throws Throwable
*/
@Test (timeout=300000)
public void testRowCountAllTable() throws Throwable {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long rowCount = aClient.rowCount(TEST_TABLE, ci,
scan);
assertEquals(ROWSIZE, rowCount);
}
项目:ditb
文件:TestDoubleColumnInterpreter.java
@Test(timeout = 300000)
public void testAvgWithValidRangeWithNoCQ() throws Throwable {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.addFamily(TEST_FAMILY);
final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci =
new DoubleColumnInterpreter();
double avg = aClient.avg(TEST_TABLE, ci, scan);
assertEquals(10.45, avg, 0.01);
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
public void testRowCountWithPrefixFilter() throws Throwable {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
Filter f = new PrefixFilter(Bytes.toBytes("foo:bar"));
scan.setFilter(f);
long rowCount = aClient.rowCount(TEST_TABLE, ci,
scan);
assertEquals(0, rowCount);
}
项目:ditb
文件:TestAggregateProtocol.java
/**
* give max for the entire table.
* @throws Throwable
*/
@Test (timeout=300000)
public void testMaxWithValidRange() throws Throwable {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.addColumn(TEST_FAMILY, TEST_QUALIFIER);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long maximum = aClient.max(TEST_TABLE, ci, scan);
assertEquals(19, maximum);
}
项目:ditb
文件:TestAggregateProtocol.java
/**
* @throws Throwable
*/
@Test (timeout=300000)
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<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long max = aClient.max(TEST_TABLE, ci, scan);
assertEquals(14, max);
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
public void testMaxWithValidRangeWithNoCQ() throws Throwable {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.addFamily(TEST_FAMILY);
final ColumnInterpreter<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long maximum = aClient.max(TEST_TABLE, ci, scan);
assertEquals(190, maximum);
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
public void testMaxWithValidRange2WithNoCQ() 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, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long max = aClient.max(TEST_TABLE, ci, scan);
assertEquals(60, max);
}
项目:ditb
文件:TestDoubleColumnInterpreter.java
@Test(timeout = 300000)
public void testSumWithValidRangeWithNoCQ() throws Throwable {
AggregationClient aClient = new AggregationClient(conf);
Scan scan = new Scan();
scan.addFamily(TEST_FAMILY);
final ColumnInterpreter<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci =
new DoubleColumnInterpreter();
double sum = aClient.sum(TEST_TABLE, ci, scan);
assertEquals(209.00, sum, 0.00); // 190 + 19
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
public void testMaxWithFilter() throws Throwable {
Long max = 0l;
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, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
max = aClient.max(TEST_TABLE, ci, scan);
assertEquals(null, max);
}
项目:ditb
文件:TestAggregateProtocol.java
/**
* @throws Throwable
*/
@Test (timeout=300000)
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<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
Long min = aClient.min(TEST_TABLE, ci,
scan);
assertEquals(0l, min.longValue());
}
项目:ditb
文件:TestAggregateProtocol.java
/**
* @throws Throwable
*/
@Test (timeout=300000)
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<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long min = aClient.min(TEST_TABLE, ci, scan);
assertEquals(5, min);
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
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<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long min = aClient.min(TEST_TABLE, ci,
scan);
assertEquals(0, min);
}
项目:ditb
文件:TestAggregateProtocol.java
@Test (timeout=300000)
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<Long, Long, EmptyMsg, LongMsg, LongMsg> ci =
new LongColumnInterpreter();
long min = aClient.min(TEST_TABLE, ci, scan);
assertEquals(6, min);
}
项目:ditb
文件:TestDoubleColumnInterpreter.java
/**
* @throws Throwable
*/
@Test(timeout = 300000)
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<Double, Double, EmptyMsg, DoubleMsg, DoubleMsg> ci =
new DoubleColumnInterpreter();
double avg = aClient.avg(TEST_TABLE, ci, scan);
assertEquals(9.5, avg, 0);
}