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 15:43:50 UTC

[GitHub] [incubator-seatunnel] zzzzzzzs opened a new pull request, #1726: [Bug] [seatunnel-connectors] Age is too far from real when using fake.

zzzzzzzs opened a new pull request, #1726:
URL: https://github.com/apache/incubator-seatunnel/pull/1726

   https://github.com/apache/incubator-seatunnel/issues/1725
   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/incubator-seatunnel/issues).
   
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
   
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   
   -->
   
   ## Purpose of this pull request
   Fixed the problem that the age is too different from the real one when using fake, and changed the system time in the previous code to a random number within 100.
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   ## Check list
   
   * [x] Code changed are covered with tests, or it does not need tests for reason:
   * [x] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/incubator-seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [x] If necessary, please update the documentation to describe the new feature. https://github.com/apache/incubator-seatunnel/tree/dev/docs
   


-- 
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


[GitHub] [incubator-seatunnel] CalvinKirs closed pull request #1726: [Bug] [seatunnel-connectors] Age is too far from real when using fake.

Posted by GitBox <gi...@apache.org>.
CalvinKirs closed pull request #1726: [Bug] [seatunnel-connectors] Age is too far from real when using fake.
URL: https://github.com/apache/incubator-seatunnel/pull/1726


-- 
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


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

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on PR #1726:
URL: https://github.com/apache/incubator-seatunnel/pull/1726#issuecomment-1128402349

   no updated, closed. if you have any updates, you can leave msg, I will reopen it.


-- 
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


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

Posted by GitBox <gi...@apache.org>.
zzzzzzzs commented on PR #1726:
URL: https://github.com/apache/incubator-seatunnel/pull/1726#issuecomment-1174777206

   > 没有更新,关闭。如果你有任何更新,你可以留下味精,我会重新打开它。
   
   Hello, it has been changed from long to int, please check it out.


-- 
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


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

Posted by GitBox <gi...@apache.org>.
zzzzzzzs commented on PR #1726:
URL: https://github.com/apache/incubator-seatunnel/pull/1726#issuecomment-1174802182

   > no updated, closed. if you have any updates, you can leave msg, I will reopen it.
   
   Hello, it has been changed from long to int, please check it out.


-- 
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


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

Posted by GitBox <gi...@apache.org>.
leo65535 commented on PR #1726:
URL: https://github.com/apache/incubator-seatunnel/pull/1726#issuecomment-1123424480

   thanks @zzzzzzzs, please modify `LONG_TYPE_INFO` to `INT_TYPE_INFO`, L51


-- 
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


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

Posted by GitBox <gi...@apache.org>.
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