Skip to content

NPE when both populateResultLevelCache and grandTotal are set #7621

@jihoonson

Description

@jihoonson

Affected Version

All versions since 0.13.0

Description

The grandTotal doesn't have timestamp and it is filled with null in the result set. If populateResultLevelCache is set, the below code is executed and input.getTimestamp().getMillis() throws NPE.

      @Override
      public Function<Result<TimeseriesResultValue>, Object> prepareForCache(boolean isResultLevelCache)
      {
        return input -> {
          TimeseriesResultValue results = input.getValue();
          final List<Object> retVal = Lists.newArrayListWithCapacity(1 + aggs.size());

          retVal.add(input.getTimestamp().getMillis());
          for (AggregatorFactory agg : aggs) {
            retVal.add(results.getMetric(agg.getName()));
          }
          if (isResultLevelCache) {
            for (PostAggregator postAgg : query.getPostAggregatorSpecs()) {
              retVal.add(results.getMetric(postAgg.getName()));
            }
          }
          return retVal;
        };
      }

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions