@Override public List<GroupbyKeyValue> read() throws IOException { return this.result.getKeyValues(); }
@Override public List<GroupbyKeyValue> read() throws IOException { return this.result.getKeyValues(); }
public void update(byte[] region, byte[] row, AggregateResult result) { AggregateResult _result = result; regionCounter ++; kvCounter += _result.getKeyValues().size(); if(this.startTimestamp == 0 || this.startTimestamp > _result.getStartTimestamp()){ this.startTimestamp = _result.getStartTimestamp(); } if(this.stopTimestamp == 0 || this.stopTimestamp < _result.getStopTimestamp()){ this.stopTimestamp = _result.getStopTimestamp(); } for(GroupbyKeyValue keyValue:_result.getKeyValues()){ update(keyValue); } }
public void update(byte[] region, byte[] row, AggregateResult result) { AggregateResult _result = result; regionCounter++; kvCounter += _result.getKeyValues().size(); if (this.startTimestamp == 0 || this.startTimestamp > _result.getStartTimestamp()) { this.startTimestamp = _result.getStartTimestamp(); } if (this.stopTimestamp == 0 || this.stopTimestamp < _result.getStopTimestamp()) { this.stopTimestamp = _result.getStopTimestamp(); } for (GroupbyKeyValue keyValue : _result.getKeyValues()) { update(keyValue); } } }
@Test public void testGroupTimeSeriesAggCountClient() { try { List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.count), Arrays.asList("count"), true, startTime, System.currentTimeMillis(), 10).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("COUNT"); logGroupbyKeyValue(result); Assert.assertNotNull(result); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupTimeSeriesAggSumClient() { try { List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.sum), Arrays.asList("field2"), true, startTime, System.currentTimeMillis(), 10).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("SUM"); logGroupbyKeyValue(result); Assert.assertNotNull(result); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupTimeSeriesAggMinClient() { try { List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.min), Arrays.asList("field2"), true, startTime, System.currentTimeMillis(), 10).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("MIN"); logGroupbyKeyValue(result); Assert.assertNotNull(result); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupTimeSeriesAggMaxClient() { try { List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.max), Arrays.asList("field2"), true, startTime, System.currentTimeMillis(), 10).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("MAX"); logGroupbyKeyValue(result); Assert.assertNotNull(result); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupTimeSeriesAggAvgClient() { try { List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.min), Arrays.asList("field2"), true, startTime, System.currentTimeMillis(), 10).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("MIN"); logGroupbyKeyValue(result); Assert.assertNotNull(result); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupTimeSeriesAggMultipleClient() { try { List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.max, AggregateFunctionType.min, AggregateFunctionType.avg, AggregateFunctionType.sum, AggregateFunctionType.count), Arrays.asList("field2", "field2", "field2", "field2", "field2"), true, startTime, System.currentTimeMillis(), 16).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("MUTILPLE"); logGroupbyKeyValue(result); Assert.assertNotNull(result); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupAggregateAvgClient() { try { EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.avg), Arrays.asList("field2")).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("AVG"); logGroupbyKeyValue(result); Assert.assertNotNull(result); Assert.assertTrue(result.size() > 0); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupAggregateCountClient() { try { EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.count), Arrays.asList("field2")).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("COUNT"); logGroupbyKeyValue(result); Assert.assertNotNull(result); Assert.assertTrue(result.size() > 0); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupAggregateMaxClient() { try { EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.max), Arrays.asList("field1")).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("MAX"); logGroupbyKeyValue(result); Assert.assertNotNull(result); Assert.assertTrue(result.size() > 0); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupAggregateMinClient() { try { EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.min), Arrays.asList("field2")).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("MIN"); logGroupbyKeyValue(result); Assert.assertNotNull(result); Assert.assertTrue(result.size() > 0); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupAggregateSumClient() { try { EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.sum), Arrays.asList("field2")).getKeyValues(); if (LOG.isDebugEnabled()) LOG.debug("MAX"); logGroupbyKeyValue(result); Assert.assertNotNull(result); Assert.assertTrue(result.size() > 0); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupAggregateMaxClient() { try { EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.max), Arrays.asList("field1")).getKeyValues(); if (LOG.isDebugEnabled()) { LOG.debug("MAX"); } logGroupbyKeyValue(result); Assert.assertNotNull(result); Assert.assertTrue(result.size() > 0); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupAggregateSumClient() { try { EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.sum), Arrays.asList("field2")).getKeyValues(); if (LOG.isDebugEnabled()) { LOG.debug("MAX"); } logGroupbyKeyValue(result); Assert.assertNotNull(result); Assert.assertTrue(result.size() > 0); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupAggregateAvgClient() { try { EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.avg), Arrays.asList("field2")).getKeyValues(); if (LOG.isDebugEnabled()) { LOG.debug("AVG"); } logGroupbyKeyValue(result); Assert.assertNotNull(result); Assert.assertTrue(result.size() > 0); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupAggregateMinClient() { try { EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Arrays.asList(AggregateFunctionType.min), Arrays.asList("field2")).getKeyValues(); if (LOG.isDebugEnabled()) { LOG.debug("MIN"); } logGroupbyKeyValue(result); Assert.assertNotNull(result); Assert.assertTrue(result.size() > 0); } catch (Exception e) { e.printStackTrace(); Assert.fail(e.getMessage()); } }
@Test public void testGroupAggregateCountClient() { try { EntityDefinition ed = EntityDefinitionManager.getEntityByServiceName("TestLogAPIEntity"); final List<GroupbyKeyValue> result = client.aggregate(table, ed, scan, Arrays.asList("cluster", "datacenter"), Collections.singletonList(AggregateFunctionType.count), Collections.singletonList("field2")).getKeyValues(); if (LOG.isDebugEnabled()) { LOG.debug("COUNT"); } logGroupbyKeyValue(result); Assert.assertNotNull(result); Assert.assertTrue(result.size() > 0); } catch (Exception e) { Assert.fail(e.getMessage()); } }