flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] dawidwys closed pull request #2568: [FLINK-4636] Add boundary check for priorityqueue for cep operator
Date Tue, 07 Aug 2018 09:40:47 GMT
dawidwys closed pull request #2568: [FLINK-4636] Add boundary check for priorityqueue for cep
operator
URL: https://github.com/apache/flink/pull/2568
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/AbstractCEPPatternOperator.java
b/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/AbstractCEPPatternOperator.java
index 64ffa2a0d1c..b428ba62d2d 100644
--- a/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/AbstractCEPPatternOperator.java
+++ b/flink-libraries/flink-cep/src/main/java/org/apache/flink/cep/operator/AbstractCEPPatternOperator.java
@@ -126,11 +126,12 @@ public void restoreState(FSDataInputStream state) throws Exception {
 
 		int numberPriorityQueueEntries = ois.readInt();
 
-		priorityQueue = new PriorityQueue<StreamRecord<IN>>(numberPriorityQueueEntries,
new StreamRecordComparator<IN>());
-
-		for (int i = 0; i <numberPriorityQueueEntries; i++) {
-			StreamElement streamElement = streamRecordSerializer.deserialize(new DataInputViewStreamWrapper(ois));
-			priorityQueue.offer(streamElement.<IN>asRecord());
+		if(numberPriorityQueueEntries > 0) {
+			priorityQueue = new PriorityQueue<StreamRecord<IN>>(numberPriorityQueueEntries,
new StreamRecordComparator<IN>());
+			for (int i = 0; i <numberPriorityQueueEntries; i++) {
+				StreamElement streamElement = streamRecordSerializer.deserialize(new DataInputViewStreamWrapper(ois));
+				priorityQueue.offer(streamElement.<IN>asRecord());
+			}
 		}
 	}
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message