public long getFirstTimestamp() { return this.result.getStartTimestamp(); }
public long getFirstTimestamp() { return this.result.getStartTimestamp(); }
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 testAggregateResultTimestamp() { AggregateResult result1 = new AggregateResult(); result1.setStartTimestamp(2L); result1.setStopTimestamp(4L); AggregateResult result2 = new AggregateResult(); result2.setStartTimestamp(1L); result2.setStopTimestamp(3L); AggregateResultCallback callback = new AggregateResultCallbackImpl(new ArrayList<AggregateFunctionType>()); callback.update(null, null, result1); callback.update(null, null, result2); AggregateResult result3 = callback.result(); Assert.assertEquals(1L, result3.getStartTimestamp()); Assert.assertEquals(4L, result3.getStopTimestamp()); }
Assert.assertTrue(result2.getStopTimestamp() > result2.getStartTimestamp()); Assert.assertTrue(result2.getStartTimestamp() > 0); Assert.assertTrue(result2.getStopTimestamp() > 0);