Github user tzulitai commented on a diff in the pull request:

    https://github.com/apache/flink/pull/3669#discussion_r130081125
  
    --- Diff: 
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/StatefulSequenceSource.java
 ---
    @@ -61,52 +65,89 @@
         * @param end End of the range of numbers to emit.
         */
        public StatefulSequenceSource(long start, long end) {
    +           Preconditions.checkArgument(start <= end);
                this.start = start;
                this.end = end;
        }
     
        @Override
        public void initializeState(FunctionInitializationContext context) 
throws Exception {
     
    -           Preconditions.checkState(this.checkpointedState == null,
    +           Preconditions.checkState(checkpointedState == null,
                        "The " + getClass().getSimpleName() + " has already 
been initialized.");
     
                this.checkpointedState = 
context.getOperatorStateStore().getOperatorState(
                        new ListStateDescriptor<>(
    -                           "stateful-sequence-source-state",
    -                           LongSerializer.INSTANCE
    +                           "stateful-sequence-source-state", 
    +                                   new TupleSerializer<>(
    +                                                   (Class<Tuple2<Long, 
Long>>) (Class<?>) Tuple2.class,
    +                                                   new TypeSerializer<?>[] 
{ LongSerializer.INSTANCE, LongSerializer.INSTANCE }
    +                                   )
                        )
                );
     
    -           this.valuesToEmit = new ArrayDeque<>();
    +           this.endToNextOffsetMapping = new HashMap<>();
                if (context.isRestored()) {
    -                   // upon restoring
    -
    -                   for (Long v : this.checkpointedState.get()) {
    -                           this.valuesToEmit.add(v);
    +                   for (Tuple2<Long, Long> partitionInfo: 
checkpointedState.get()) {
    --- End diff --
    
    nit: empty spaces should surround ":"


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to