use of org.apache.geode.cache.query.internal.index.IndexData in project geode by apache.
the class QueryUtils method getAvailableIndexIfAny.
private static IndexData getAvailableIndexIfAny(CompiledValue cv, ExecutionContext context, boolean usePrimaryIndex) throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
Set set = new HashSet();
context.computeUltimateDependencies(cv, set);
if (set.size() != 1)
return null;
RuntimeIterator rIter = (RuntimeIterator) set.iterator().next();
String regionPath = null;
// collection is not a Region
if (rIter.getScopeID() != context.currentScope().getScopeID() || /* context.getScopeCount() */
(regionPath = context.getRegionPathForIndependentRuntimeIterator(rIter)) == null) {
return null;
}
// The independent iterator is added as the first element
List groupRuntimeItrs = context.getCurrScopeDpndntItrsBasedOnSingleIndpndntItr(rIter);
String[] definitions = new String[groupRuntimeItrs.size()];
Iterator iterator = groupRuntimeItrs.iterator();
int i = 0;
while (iterator.hasNext()) {
RuntimeIterator rIterator = (RuntimeIterator) iterator.next();
definitions[i++] = rIterator.getDefinition();
}
IndexData indexData = IndexUtils.findIndex(regionPath, definitions, cv, "*", context.getCache(), usePrimaryIndex, context);
if (indexData != null) {
if (logger.isDebugEnabled()) {
logger.debug("Indexed expression for indexed data : {} for region : {}", indexData.getIndex().getCanonicalizedIndexedExpression(), regionPath);
}
}
return indexData;
}
Aggregations