// use statement-wide agent-instance-specific aggregation service
aggregationService = statementContext.getStatementAgentInstanceRegistry().getAgentInstanceAggregationService();
// use statement-wide agent-instance-specific subselects
AIRegistryExpr aiRegistryExpr = statementContext.getStatementAgentInstanceRegistry().getAgentInstanceExprService();
subselectStrategyInstances = new HashMap<ExprSubselectNode, SubSelectStrategyHolder>();
for (Map.Entry<ExprSubselectNode, SubSelectStrategyFactoryDesc> entry : selectDesc.getSubSelectStrategyCollection().getSubqueries().entrySet()) {
AIRegistrySubselect specificService = aiRegistryExpr.allocateSubselect(entry.getKey());
entry.getKey().setStrategy(specificService);
Map<ExprPriorNode, ExprPriorEvalStrategy> subselectPriorStrategies = new HashMap<ExprPriorNode, ExprPriorEvalStrategy>();
for (ExprPriorNode subselectPrior : entry.getValue().getPriorNodesList()) {
AIRegistryPrior specificSubselectPriorService = aiRegistryExpr.allocatePrior(subselectPrior);
subselectPriorStrategies.put(subselectPrior, specificSubselectPriorService);
}
Map<ExprPreviousNode, ExprPreviousEvalStrategy> subselectPreviousStrategies = new HashMap<ExprPreviousNode, ExprPreviousEvalStrategy>();
for (ExprPreviousNode subselectPrevious : entry.getValue().getPrevNodesList()) {
AIRegistryPrevious specificSubselectPreviousService = aiRegistryExpr.allocatePrevious(subselectPrevious);
subselectPreviousStrategies.put(subselectPrevious, specificSubselectPreviousService);
}
subselectStrategyInstances.put(entry.getKey(), new SubSelectStrategyHolder(specificService, aggregationService, subselectPriorStrategies, subselectPreviousStrategies, null, null));
}
// use statement-wide agent-instance-specific "prior"
priorStrategyInstances = new HashMap<ExprPriorNode, ExprPriorEvalStrategy>();
for (ExprPriorNode priorNode : selectDesc.getViewResourceDelegateUnverified().getPriorRequests()) {
AIRegistryPrior specificService = aiRegistryExpr.allocatePrior(priorNode);
priorStrategyInstances.put(priorNode, specificService);
}
// use statement-wide agent-instance-specific "previous"
previousStrategyInstances = new HashMap<ExprPreviousNode, ExprPreviousEvalStrategy>();
for (ExprPreviousNode previousNode : selectDesc.getViewResourceDelegateUnverified().getPreviousRequests()) {
AIRegistryPrevious specificService = aiRegistryExpr.allocatePrevious(previousNode);
previousStrategyInstances.put(previousNode, specificService);
}
ContextMergeView mergeView = new ContextMergeView(selectDesc.getResultSetProcessorPrototypeDesc().getResultSetProcessorFactory().getResultEventType());
finalViewable = mergeView;