@Override public void aggregate(RpcController controller, AggregateProtos.AggregateRequest request, RpcCallback<AggregateProtos.AggregateResult> done) { AggregateResult result = null; try { result = this.aggregate(ProtoBufConverter.fromPBEntityDefinition(request.getEntityDefinition()), ProtoBufConverter.fromPBScan(request.getScan()), ProtoBufConverter.fromPBStringList(request.getGroupbyFieldsList()), ProtoBufConverter.fromPBByteArrayList(request.getAggregateFuncTypesList()), ProtoBufConverter.fromPBStringList(request.getAggregatedFieldsList()) ); } catch (IOException e) { ResponseConverter.setControllerException(controller, e); } try { done.run(ProtoBufConverter.toPBAggregateResult(result)); } catch (IOException e) { throw new RuntimeException("Failed to convert result to PB-based message", e); } }
@Override public void aggregate(RpcController controller, AggregateProtos.AggregateRequest request, RpcCallback<AggregateProtos.AggregateResult> done) { AggregateResult result = null; try { result = this.aggregate(ProtoBufConverter.fromPBEntityDefinition(request.getEntityDefinition()), ProtoBufConverter.fromPBScan(request.getScan()), ProtoBufConverter.fromPBStringList(request.getGroupbyFieldsList()), ProtoBufConverter.fromPBByteArrayList(request.getAggregateFuncTypesList()), ProtoBufConverter.fromPBStringList(request.getAggregatedFieldsList()) ); } catch (IOException e) { ResponseConverter.setControllerException(controller, e); } try { done.run(ProtoBufConverter.toPBAggregateResult(result)); } catch (IOException e) { throw new RuntimeException("Failed to convert result to PB-based message",e); } }
@Override public void timeseriesAggregate(RpcController controller, AggregateProtos.TimeSeriesAggregateRequest request, RpcCallback<AggregateProtos.AggregateResult> done) { AggregateResult result = null; try { result = this.aggregate(ProtoBufConverter.fromPBEntityDefinition(request.getEntityDefinition()), ProtoBufConverter.fromPBScan(request.getScan()), ProtoBufConverter.fromPBStringList(request.getGroupbyFieldsList()), ProtoBufConverter.fromPBByteArrayList(request.getAggregateFuncTypesList()), ProtoBufConverter.fromPBStringList(request.getAggregatedFieldsList()), request.getStartTime(), request.getEndTime(), request.getIntervalMin() ); } catch (IOException e) { LOG.error("Failed to convert result to PB-based message", e); ResponseConverter.setControllerException(controller, e); } try { done.run(ProtoBufConverter.toPBAggregateResult(result)); } catch (IOException e) { LOG.error("Failed to convert result to PB-based message", e); ResponseConverter.setControllerException(controller, e); } }
@Override public void timeseriesAggregate(RpcController controller, AggregateProtos.TimeSeriesAggregateRequest request, RpcCallback<AggregateProtos.AggregateResult> done) { AggregateResult result = null; try { result = this.aggregate(ProtoBufConverter.fromPBEntityDefinition(request.getEntityDefinition()), ProtoBufConverter.fromPBScan(request.getScan()), ProtoBufConverter.fromPBStringList(request.getGroupbyFieldsList()), ProtoBufConverter.fromPBByteArrayList(request.getAggregateFuncTypesList()), ProtoBufConverter.fromPBStringList(request.getAggregatedFieldsList()), request.getStartTime(), request.getEndTime(), request.getIntervalMin() ); } catch (IOException e) { LOG.error("Failed to convert result to PB-based message",e); ResponseConverter.setControllerException(controller, e); } try { done.run(ProtoBufConverter.toPBAggregateResult(result)); } catch (IOException e) { LOG.error("Failed to convert result to PB-based message",e); ResponseConverter.setControllerException(controller, e); } }