You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/04/22 16:09:10 UTC

[GitHub] [incubator-seatunnel] ruanwenjun commented on a diff in pull request #1726: [Bug] [seatunnel-connectors] Age is too far from real when using fake.

ruanwenjun commented on code in PR #1726:
URL: https://github.com/apache/incubator-seatunnel/pull/1726#discussion_r856378742


##########
seatunnel-connectors/seatunnel-connectors-flink/seatunnel-connector-flink-fake/src/main/java/org/apache/seatunnel/flink/fake/source/FakeSourceStream.java:
##########
@@ -67,12 +68,14 @@ public String getPluginName() {
     }
 
     private static final String[] NAME_ARRAY = new String[]{"Gary", "Ricky Huo", "Kid Xiong"};
+    private static final int AGE_LIMIT = 100;
 
     @Override
     public void run(SourceContext<Row> ctx) throws Exception {
+        Random random = new Random();
         while (running) {
             int randomNum = (int) (1 + Math.random() * NAME_ARRAY.length);
-            Row row = Row.of(NAME_ARRAY[randomNum - 1], System.currentTimeMillis());
+            Row row = Row.of(NAME_ARRAY[randomNum - 1], (long) random.nextInt(AGE_LIMIT));

Review Comment:
   Use int here is ok, you don't need to convert to long. You can change the type in line 51



-- 
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: commits-unsubscribe@seatunnel.apache.org

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