@Override
        public int compare(StateEvent o1, StateEvent o2) {
            if (o1.getTimestamp() == -1) {
                if (o2.getTimestamp() == -1) {
                    return 0;
                } else {
                    return 1;
                }
            } else if (o2.getTimestamp() == -1) {
                return -1;
            }
            return Long.compare(o1.getTimestamp(), o2.getTimestamp());
        }
The processor the gets executes before checking state conditions.
modules/siddhi-core/src/main/java/io/siddhi/core/query/input/stream/state/StreamPreStateProcessor.java