}
}
final RolapStar.Measure measure = request.getMeasure();
final RolapStar star = measure.getStar();
final RolapSchema schema = star.getSchema();
final SegmentCacheIndex index =
cacheMgr.getIndexRegistry().getIndex(star);
final List<SegmentHeader> headersInCache =
index.locate(
schema.getName(),
schema.getChecksum(),
measure.getCubeName(),
measure.getName(),
star.getFactTable().getAlias(),
request.getConstrainedColumnsBitKey(),
mappedCellValues,
compoundPredicates);
// Ask for the first segment to be loaded from cache. (If it's no longer
// in cache, we'll be back, and presumably we'll try the second
// segment.)
if (!headersInCache.isEmpty()) {
for (SegmentHeader headerInCache : headersInCache) {
final Future<SegmentBody> future =
index.getFuture(locus.execution, headerInCache);
if (future != null) {
// Segment header is in cache, body is being loaded.
// Worker will need to wait for load to complete.
futures.put(headerInCache, future);
} else {
// Segment is in cache.
cacheHeaders.add(headerInCache);
}
index.setConverter(
headerInCache.schemaName,
headerInCache.schemaChecksum,
headerInCache.cubeName,
headerInCache.rolapStarFactTableName,
headerInCache.measureName,
headerInCache.compoundPredicates,
converter);
converterMap.put(
SegmentCacheIndexImpl.makeConverterKey(request, key),
converter);
}
return true;
}
// Try to roll up if the measure's rollup aggregator supports
// "fast" aggregation from raw objects.
//
// Do not try to roll up if this request has already chosen a rollup
// with the same target dimensionality. It is quite likely that the
// other rollup will satisfy this request, and it's complicated to be
// 100% sure. If we're wrong, we'll be back.
// Also make sure that we don't try to rollup a measure which
// doesn't support rollup from raw data, like a distinct count
// for example. Both the measure's aggregator and its rollup
// aggregator must support raw data aggregation. We call
// Aggregator.supportsFastAggregates() to verify.
if (MondrianProperties.instance()
.EnableInMemoryRollup.get()
&& measure.getAggregator().supportsFastAggregates(
measure.getDatatype())
&& measure.getAggregator().getRollup().supportsFastAggregates(
measure.getDatatype())
&& !isRequestCoveredByRollups(request))
{
// Don't even bother doing a segment lookup if we can't
// rollup that measure.
final List<List<SegmentHeader>> rollup =
index.findRollupCandidates(
schema.getName(),
schema.getChecksum(),
measure.getCubeName(),
measure.getName(),
star.getFactTable().getAlias(),