[TE] gracefully handle null and empty responses
@@ -69,15 +69,13 @@ public class ResponseParserUtils {
requestBuilder.setMetricFunctions(request.getMetricFunctions());
requestBuilder.setDataSource(ThirdEyeUtils.getDataSourceFromMetricFunctions(request.getMetricFunctions()));
ThirdEyeRequest metricSumsRequest = requestBuilder.build("metricSums");
- ThirdEyeResponse metricSumsResponse = null;
try {
- metricSumsResponse =
- CACHE_REGISTRY_INSTANCE.getQueryCache().getQueryResult(metricSumsRequest);
+ ThirdEyeResponse metricSumsResponse = CACHE_REGISTRY_INSTANCE.getQueryCache().getQueryResult(metricSumsRequest);
+ return metricSumsResponse.getRow(0).getMetrics();
} catch (Exception e) {
LOGGER.error("Caught exception when executing metric sums request", e);
}
- List<Double> metricSums = metricSumsResponse.getRow(0).getMetrics();
- return metricSums;
+ return Collections.emptyList();
}
public static Map<Integer, List<Double>> getMetricSumsByTime(ThirdEyeResponse response) {
