xuzhiwen1255 commented on code in PR #21971:
URL: https://github.com/apache/flink/pull/21971#discussion_r1193156464


##########
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/datagen/SequenceGenerator.java:
##########
@@ -49,10 +50,18 @@
     /**
      * Creates a DataGenerator that emits all numbers from the given interval 
exactly once.
      *
+     * <p>He requires that the end must be greater than the start and that the 
total number cannot
+     * be greater than max-1.
+     *

Review Comment:
   Done.



##########
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/functions/source/datagen/SequenceGenerator.java:
##########
@@ -111,11 +120,20 @@ public boolean hasNext() {
         return !this.valuesToEmit.isEmpty();
     }
 
-    private static int safeDivide(long left, long right) {
-        Preconditions.checkArgument(right > 0);
-        Preconditions.checkArgument(left >= 0);
-        Preconditions.checkArgument(left <= Integer.MAX_VALUE * right);
-        return (int) (left / right);
+    private static long safeDivide(long totalRows, long stepSize) {
+        Preconditions.checkArgument(stepSize > 0, "cannot be equal to 0");
+        Preconditions.checkArgument(totalRows >= 0, "Cannot be less than 0");
+        return totalRows / stepSize;
+    }

Review Comment:
   Done.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to