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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to