use of io.siddhi.core.util.collection.operator.IndexOperatorForCache in project siddhi by wso2.
the class OperatorParser method constructOperatorForCache.
public static Operator constructOperatorForCache(Object storeEvents, Expression expression, MatchingMetaInfoHolder matchingMetaInfoHolder, List<VariableExpressionExecutor> variableExpressionExecutors, Map<String, Table> tableMap, SiddhiQueryContext siddhiQueryContext, boolean updateCachePolicyAttribute, CacheTable cacheTable) {
if (storeEvents instanceof IndexedEventHolder && updateCachePolicyAttribute) {
CollectionExpression collectionExpression = CollectionExpressionParser.parseCollectionExpression(expression, matchingMetaInfoHolder, (IndexedEventHolder) storeEvents);
CollectionExecutor collectionExecutor = CollectionExpressionParser.buildCollectionExecutor(collectionExpression, matchingMetaInfoHolder, variableExpressionExecutors, tableMap, true, ProcessingMode.BATCH, false, siddhiQueryContext, true, cacheTable);
if (collectionExpression instanceof CompareCollectionExpression && ((CompareCollectionExpression) collectionExpression).getOperator() == Compare.Operator.EQUAL && (collectionExpression.getCollectionScope() == INDEXED_RESULT_SET || collectionExpression.getCollectionScope() == PRIMARY_KEY_RESULT_SET) && ((IndexedEventHolder) storeEvents).getPrimaryKeyReferenceHolders() != null && ((IndexedEventHolder) storeEvents).getPrimaryKeyReferenceHolders().length == 1 && ((IndexedEventHolder) storeEvents).getPrimaryKeyReferenceHolders()[0].getPrimaryKeyAttribute().equals(((AttributeCollectionExpression) ((CompareCollectionExpression) collectionExpression).getAttributeCollectionExpression()).getAttribute())) {
return new OverwriteTableIndexOperatorForCache(collectionExecutor, siddhiQueryContext.getName(), cacheTable);
} else if (collectionExpression instanceof AndMultiPrimaryKeyCollectionExpression && collectionExpression.getCollectionScope() == PRIMARY_KEY_RESULT_SET) {
return new OverwriteTableIndexOperatorForCache(collectionExecutor, siddhiQueryContext.getName(), cacheTable);
} else {
return new IndexOperatorForCache(collectionExecutor, siddhiQueryContext.getName(), cacheTable);
}
}
return constructOperator(storeEvents, expression, matchingMetaInfoHolder, variableExpressionExecutors, tableMap, siddhiQueryContext);
}
Aggregations