StarTreeRecordStoreDefaultImpl implements StarTreeRecordStore { @Override public Number[] getMetricSums(StarTreeQuery query) { return doQuery(query).getMetricSums(); } StarTreeRecordStoreDefaultImpl(StarTreeConfig config,
                                        DimensionStore dimensionStore,
                                        MetricStore metricStore); @Override void update(StarTreeRecord record); @Override Iterator<StarTreeRecord> iterator(); @Override void clear(); @Override void open(); @Override void close(); @Override int getRecordCount(); @Override int getRecordCountEstimate(); @Override int getCardinality(String dimensionName); @Override String getMaxCardinalityDimension(); @Override String getMaxCardinalityDimension(Collection<String> blacklist); @Override Set<String> getDimensionValues(String dimensionName); @Override Number[] getMetricSums(StarTreeQuery query); @Override Long getMinTime(); @Override Long getMaxTime(); @Override Map<TimeRange, Integer> getTimeRangeCount(); @Override MetricTimeSeries getTimeSeries(StarTreeQuery query); @Override Map<String, Map<String, Integer>> getForwardIndex();  }
@Test public void testGetMetricSums_oneSegment_allStar() { StarTreeQuery query = new StarTreeQueryImpl.Builder() .setDimensionKey(getDimensionKey(StarTreeConstants.STAR, StarTreeConstants.STAR, StarTreeConstants.STAR)) .setTimeRange(new TimeRange(0L, 0L)) .build(config); Number[] sums = recordStore.getMetricSums(query); Assert.assertEquals(sums, getSums(10)); }
@Test public void testGetMetricSums_twoSegment_allStar() { StarTreeQuery query = new StarTreeQueryImpl.Builder() .setDimensionKey(getDimensionKey(StarTreeConstants.STAR, StarTreeConstants.STAR, StarTreeConstants.STAR)) .setTimeRange(new TimeRange(0L, 7L)) .build(config); Number[] sums = recordStore.getMetricSums(query); Assert.assertEquals(sums, getSums(80)); }
@Test public void testGetMetricSums_oneSegment_someStar() { StarTreeQuery query = new StarTreeQueryImpl.Builder() .setDimensionKey(getDimensionKey("A0", StarTreeConstants.STAR, StarTreeConstants.STAR)) .setTimeRange(new TimeRange(0L, 0L)) .build(config); Number[] sums = recordStore.getMetricSums(query); Assert.assertEquals(sums, getSums(4)); }
@Test public void testGetMetricSums_twoSegment_someStar() { StarTreeQuery query = new StarTreeQueryImpl.Builder() .setDimensionKey(getDimensionKey("A0", StarTreeConstants.STAR, StarTreeConstants.STAR)) .setTimeRange(new TimeRange(0L, 7L)) .build(config); Number[] sums = recordStore.getMetricSums(query); Assert.assertEquals(sums, getSums(8 * 4)); }