private void update(IndexedEventHolder storeEvents, InMemoryCompiledUpdateSet compiledUpdateSet,
                        StateEvent overwritingOrAddingEvent, ComplexEventChunk<StreamEvent> foundEventChunk) {
        //for cases when indexed attribute is also updated but that not changed
        //to reduce number of passes needed to update the events
        boolean doDeleteUpdate = false;
        boolean fail = false;
        for (Map.Entry<Integer, ExpressionExecutor> entry :
                compiledUpdateSet.getExpressionExecutorMap().entrySet()) {
            if (doDeleteUpdate || fail) {
                break;
            }
            if (storeEvents.isAttributeIndexed(entry.getKey())) {
                //Todo how much check we need to do before falling back to Delete and then Update
                foundEventChunk.reset();
                Set<Object> keys = null;
                PrimaryKeyReferenceHolder[] primaryKeyReferenceHolders = storeEvents.getPrimaryKeyReferenceHolders();
                if (primaryKeyReferenceHolders != null
                        && primaryKeyReferenceHolders.length == 1
                        && entry.getKey() == primaryKeyReferenceHolders[0].getPrimaryKeyPosition()) {
                    keys = new HashSet<>(storeEvents.getAllPrimaryKeyValues());
                }
                while (foundEventChunk.hasNext()) {
                    StreamEvent streamEvent = foundEventChunk.next();
                    Object updatingData = entry.getValue().execute(overwritingOrAddingEvent);
                    Object storeEventData = streamEvent.getOutputData()[entry.getKey()];
                    if (updatingData != null && storeEventData != null && !updatingData.equals(storeEventData)) {
                        doDeleteUpdate = true;
                        if (keys == null || keys.size() == 0) {
                            break;
                        } else {
                            keys.remove(storeEventData);
                            if (!keys.add(updatingData)) {
                                log.error("Update failed for event :" + overwritingOrAddingEvent + ", as there is " +
                                        "already an event stored with primary key '" +
                                        updatingData + "' at '" + queryName + "'");
                                fail = true;
                                break;
                            }
                        }
                    }
                }
            }
        }
        foundEventChunk.reset();
        if (!fail) {
            //other cases not yet supported by Siddhi

            if (doDeleteUpdate) {
                collectionExecutor.delete(overwritingOrAddingEvent, storeEvents);
                ComplexEventChunk<StreamEvent> toUpdateEventChunk = new ComplexEventChunk<>();
                while (foundEventChunk.hasNext()) {
                    StreamEvent streamEvent = foundEventChunk.next();
                    foundEventChunk.remove();
                    streamEvent.setNext(null); // to make the chained state back to normal
                    for (Map.Entry<Integer, ExpressionExecutor> entry :
                            compiledUpdateSet.getExpressionExecutorMap().entrySet()) {
                        streamEvent.setOutputData(entry.getValue().execute(overwritingOrAddingEvent), entry.getKey());
                    }
                    toUpdateEventChunk.add(streamEvent);
                }
                storeEvents.add(toUpdateEventChunk);
            } else {
                StreamEvent first = foundEventChunk.getFirst();
                while (first != null) {
                    StreamEvent streamEvent = first;
                    handleCachePolicyAttributeUpdate(streamEvent);
                    for (Map.Entry<Integer, ExpressionExecutor> entry :
                            compiledUpdateSet.getExpressionExecutorMap().entrySet()) {
                        streamEvent.setOutputData(entry.getValue().execute(overwritingOrAddingEvent), entry.getKey());
                    }
                    StreamEvent next = first.getNext();
                    first.setNext(null); // to make the chained state back to normal
                    first = next;
                }
            }
        }
    }
Operator which is related to non-indexed In-memory table operations.
modules/siddhi-core/src/main/java/io/siddhi/core/util/collection/operator/IndexOperator.java