@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 }
@Test (timeout=300000) public void testMaxWithInvalidRange2() throws Throwable { BigDecimal max = new BigDecimal(Long.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<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> 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 }
@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 }
@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 }
@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 }
@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 }
@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 }
@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 }
@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 }
@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 }
@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 }
@Test public void testMaxWithInvalidRange2() throws Throwable { BigDecimal max = new BigDecimal(Long.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<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 }
/** * @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<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci = new BigDecimalColumnInterpreter(); BigDecimal median = aClient.median(TEST_TABLE, ci, scan); assertEquals(new BigDecimal("8.00"), median); }
/** * 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<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci = new BigDecimalColumnInterpreter(); BigDecimal maximum = aClient.max(TEST_TABLE, ci, scan); assertEquals(new BigDecimal("19.00"), maximum); }
/** * @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<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci = new BigDecimalColumnInterpreter(); BigDecimal max = aClient.max(TEST_TABLE, ci, scan); assertEquals(new BigDecimal("14.00"), max); }
@Test (timeout=300000) public void testMaxWithValidRangeWithNoCQ() throws Throwable { AggregationClient aClient = new AggregationClient(conf); Scan scan = new Scan(); scan.addFamily(TEST_FAMILY); final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci = new BigDecimalColumnInterpreter(); BigDecimal maximum = aClient.max(TEST_TABLE, ci, scan); assertEquals(new BigDecimal("19.00"), maximum); }
@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<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci = new BigDecimalColumnInterpreter(); BigDecimal max = aClient.max(TEST_TABLE, ci, scan); assertEquals(new BigDecimal("6.00"), max); }
@Test (timeout=300000) public void testMaxWithValidRangeWithNullCF() { AggregationClient aClient = new AggregationClient(conf); final ColumnInterpreter<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> 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 }
@Test (timeout=300000) 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, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci = new BigDecimalColumnInterpreter(); max = aClient.max(TEST_TABLE, ci, scan); assertEquals(null, max); }
/** * @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<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci = new BigDecimalColumnInterpreter(); BigDecimal min = aClient.min(TEST_TABLE, ci, scan); assertEquals(new BigDecimal("0.00"), min); }
/** * @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<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci = new BigDecimalColumnInterpreter(); BigDecimal min = aClient.min(TEST_TABLE, ci, scan); assertEquals(new BigDecimal("5.00"), min); }
@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<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci = new BigDecimalColumnInterpreter(); BigDecimal min = aClient.min(TEST_TABLE, ci, scan); assertEquals(new BigDecimal("0.00"), min); }
@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<BigDecimal, BigDecimal, EmptyMsg, BigDecimalMsg, BigDecimalMsg> ci = new BigDecimalColumnInterpreter(); BigDecimal min = aClient.min(TEST_TABLE, ci, scan); assertEquals(new BigDecimal("0.60"), min); }