Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,11 @@ public void onProcessingTime(InternalTimer<KEY, VoidNamespace> timer) throws Exc

// STEP 4
updateNFA(nfa);

// In order to remove dangling partial matches.
if (nfa.getPartialMatches().size() == 1 && nfa.getCompletedMatches().isEmpty()) {
computationStates.clear();
}
}

private Stream<IN> sort(Collection<IN> elements) {
Expand Down Expand Up @@ -551,6 +556,12 @@ boolean hasNonEmptyPQ(KEY key) throws Exception {
return !elementQueueState.isEmpty();
}

@VisibleForTesting
boolean hasNonEmptyNFAState(KEY key) throws Exception {
setCurrentKey(key);
return computationStates.value() != null;
}

@VisibleForTesting
int getPQSize(KEY key) throws Exception {
setCurrentKey(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,24 @@ public void testCEPOperatorCleanupProcessingTime() throws Exception {
}
}

@Test
public void testCEPOperatorClearsExpiredNFAStateInProcessingTime() throws Exception {
CepOperator<Event, Integer, Map<String, List<Event>>> operator = getKeyedCepOperator(true);

try (OneInputStreamOperatorTestHarness<Event, Map<String, List<Event>>> harness =
CepOperatorTestUtilities.getCepTestHarness(operator)) {
harness.open();
harness.setProcessingTime(1L);
harness.processElement(new StreamRecord<>(new Event(26, "start", 1.0)));

assertTrue(operator.hasNonEmptyNFAState(26));

harness.setProcessingTime(20L);

assertFalse(operator.hasNonEmptyNFAState(26));
}
}

@Test
public void testCEPOperatorSerializationWRocksDB() throws Exception {
String rocksDbPath = tempFolder.newFolder().getAbsolutePath();
Expand Down