Search in sources :

Example 1 with OverwriteTableIndexOperatorForCache

use of io.siddhi.core.util.collection.operator.OverwriteTableIndexOperatorForCache 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);
}
Also used : IndexOperatorForCache(io.siddhi.core.util.collection.operator.IndexOperatorForCache) OverwriteTableIndexOperatorForCache(io.siddhi.core.util.collection.operator.OverwriteTableIndexOperatorForCache) CompareCollectionExpression(io.siddhi.core.util.collection.expression.CompareCollectionExpression) AttributeCollectionExpression(io.siddhi.core.util.collection.expression.AttributeCollectionExpression) IndexedEventHolder(io.siddhi.core.table.holder.IndexedEventHolder) AndMultiPrimaryKeyCollectionExpression(io.siddhi.core.util.collection.expression.AndMultiPrimaryKeyCollectionExpression) CollectionExecutor(io.siddhi.core.util.collection.executor.CollectionExecutor) OverwriteTableIndexOperatorForCache(io.siddhi.core.util.collection.operator.OverwriteTableIndexOperatorForCache) CollectionExpression(io.siddhi.core.util.collection.expression.CollectionExpression) CompareCollectionExpression(io.siddhi.core.util.collection.expression.CompareCollectionExpression) AndMultiPrimaryKeyCollectionExpression(io.siddhi.core.util.collection.expression.AndMultiPrimaryKeyCollectionExpression) AttributeCollectionExpression(io.siddhi.core.util.collection.expression.AttributeCollectionExpression)

Aggregations

IndexedEventHolder (io.siddhi.core.table.holder.IndexedEventHolder)1 CollectionExecutor (io.siddhi.core.util.collection.executor.CollectionExecutor)1 AndMultiPrimaryKeyCollectionExpression (io.siddhi.core.util.collection.expression.AndMultiPrimaryKeyCollectionExpression)1 AttributeCollectionExpression (io.siddhi.core.util.collection.expression.AttributeCollectionExpression)1 CollectionExpression (io.siddhi.core.util.collection.expression.CollectionExpression)1 CompareCollectionExpression (io.siddhi.core.util.collection.expression.CompareCollectionExpression)1 IndexOperatorForCache (io.siddhi.core.util.collection.operator.IndexOperatorForCache)1 OverwriteTableIndexOperatorForCache (io.siddhi.core.util.collection.operator.OverwriteTableIndexOperatorForCache)1