flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From greghogan <...@git.apache.org>
Subject [GitHub] flink pull request #2568: [FLINK-4636] Add boundary check for priorityqueue ...
Date Thu, 29 Sep 2016 14:58:04 GMT
Github user greghogan commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2568#discussion_r81155827
  
    --- Diff: 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>());
    --- End diff --
    
    Initialize with size `Math.max(INITIAL_PRIORITY_QUEUE_CAPACITY, numberPriorityQueueEntries)`?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message