You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "morozov (via GitHub)" <gi...@apache.org> on 2024/04/20 01:02:30 UTC

[PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

morozov opened a new pull request, #24692:
URL: https://github.com/apache/flink/pull/24692

   <!--
   *Thank you very much for contributing to Apache Flink - we are happy that you want to help us improve Flink. To help the community review your contribution in the best possible way, please go through the checklist below, which will get the contribution into a shape in which it can be best reviewed.*
   
   *Please understand that we do not do this to make contributions to Flink a hassle. In order to uphold a high standard of quality for code contributions, while at the same time managing a large number of contributions, we need contributors to prepare the contributions well, and give reviewers enough contextual information for the review. Please also understand that contributions that do not follow this guide will take longer to review and thus typically be picked up with lower priority by the community.*
   
   ## Contribution Checklist
   
     - Make sure that the pull request corresponds to a [JIRA issue](https://issues.apache.org/jira/projects/FLINK/issues). Exceptions are made for typos in JavaDoc or documentation files, which need no JIRA issue.
     
     - Name the pull request in the form "[FLINK-XXXX] [component] Title of the pull request", where *FLINK-XXXX* should be replaced by the actual issue number. Skip *component* if you are unsure about which is the best component.
     Typo fixes that have no associated JIRA issue should be named following this pattern: `[hotfix] [docs] Fix typo in event time introduction` or `[hotfix] [javadocs] Expand JavaDoc for PuncuatedWatermarkGenerator`.
   
     - Fill out the template below to describe the changes contributed by the pull request. That will give reviewers the context they need to do the review.
     
     - Make sure that the change passes the automated tests, i.e., `mvn clean verify` passes. You can set up Azure Pipelines CI to do that following [this guide](https://cwiki.apache.org/confluence/display/FLINK/Azure+Pipelines#AzurePipelines-Tutorial:SettingupAzurePipelinesforaforkoftheFlinkrepository).
   
     - Each pull request should address only one issue, not mix up code from multiple issues.
     
     - Each commit in the pull request has a meaningful commit message (including the JIRA id)
   
     - Once all items of the checklist are addressed, remove the above text and this checklist, leaving only the filled out template below.
   
   
   **(The sections below can be removed for hotfixes of typos)**
   -->
   
   ## What is the purpose of the change
   
   The code [examples](https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/connectors/datastream/datagen/#rate-limiting) used in the documentation are incorrect. Currently, they look like this:
   ```java
   GeneratorFunction<Long, Long> generatorFunction = index -> index;
   double recordsPerSecond = 100;
   
   DataGeneratorSource<String> source =
           new DataGeneratorSource<>(
                generatorFunction,
                Long.MAX_VALUE,
                RateLimiterStrategy.perSecond(recordsPerSecond),
                Types.STRING);
   ```
   
   The generator function returns `Long `but the `DataGeneratorSource` uses `String` and `Types.STRING`, so the types do not match, and the example code cannot be compiled.
   
   ## Brief change log
   
   The types used by the `DataGeneratorSource` are updated to match the return type of the generator function.
   
   ## Verifying this change
   
   Please make sure both new and modified tests in this PR follow [the conventions for tests defined in our code quality guide](https://flink.apache.org/how-to-contribute/code-style-and-quality-common/#7-testing).
   
   This change is a trivial rework / code cleanup without any test coverage.
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): no
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: no
     - The serializers: no
     - The runtime per-record code paths (performance sensitive): no
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
     - The S3 file system connector: no
   
   ## Documentation
   
     - Does this pull request introduce a new feature? no
     - If yes, how is the feature documented? not applicable
   


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "morozov (via GitHub)" <gi...@apache.org>.
morozov commented on code in PR #24692:
URL: https://github.com/apache/flink/pull/24692#discussion_r1732153194


##########
docs/content.zh/docs/connectors/datastream/datagen.md:
##########
@@ -65,14 +65,13 @@ Rate Limiting
 `Long` values at the overall source rate (across all source subtasks) not exceeding 100 events per second.
 
 ```java
-GeneratorFunction<Long, Long> generatorFunction = index -> index;
-double recordsPerSecond = 100;
+GeneratorFunction<Long, String> generatorFunction = index -> "Number: " + index;
 
 DataGeneratorSource<String> source =
         new DataGeneratorSource<>(
              generatorFunction,
              Long.MAX_VALUE,
-             RateLimiterStrategy.perSecond(recordsPerSecond),
+             RateLimiterStrategy.perSecond(4),

Review Comment:
   Good catch 🤦‍♂️ Fixed.



-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "morozov (via GitHub)" <gi...@apache.org>.
morozov commented on PR #24692:
URL: https://github.com/apache/flink/pull/24692#issuecomment-2308895535

   @GOODBOY008 done. FWIW, you can reference code blocks right on GitHub. This way, then are better readable and could be navigated to:
   
   https://github.com/apache/flink/blob/4faf0966766e3734792f80ed66e512aa3033cacd/flink-connectors/flink-connector-datagen/src/main/java/org/apache/flink/connector/datagen/source/DataGeneratorSource.java#L79-L86


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on PR #24692:
URL: https://github.com/apache/flink/pull/24692#issuecomment-2314102983

   @morozov Can you open another pr to branch `release-1.20` ?


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on PR #24692:
URL: https://github.com/apache/flink/pull/24692#issuecomment-2309389579

   the idea is to have same example both in doc and example module where compilation is checked during ci process


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on PR #24692:
URL: https://github.com/apache/flink/pull/24692#issuecomment-2314045037

   @morozov LGTM


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on code in PR #24692:
URL: https://github.com/apache/flink/pull/24692#discussion_r1732070723


##########
docs/content.zh/docs/connectors/datastream/datagen.md:
##########
@@ -65,14 +65,13 @@ Rate Limiting
 `Long` values at the overall source rate (across all source subtasks) not exceeding 100 events per second.
 
 ```java
-GeneratorFunction<Long, Long> generatorFunction = index -> index;
-double recordsPerSecond = 100;
+GeneratorFunction<Long, String> generatorFunction = index -> "Number: " + index;
 
 DataGeneratorSource<String> source =
         new DataGeneratorSource<>(
              generatorFunction,
              Long.MAX_VALUE,
-             RateLimiterStrategy.perSecond(recordsPerSecond),
+             RateLimiterStrategy.perSecond(4),

Review Comment:
   The `RateLimiterStrategy` value is not corresponding to the comment.
   https://github.com/apache/flink/blob/5217d50e58e6210e60c3e8a46ac948ccc7f0c901/docs/content.zh/docs/connectors/datastream/datagen.md?plain=1#L64-L65



-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "morozov (via GitHub)" <gi...@apache.org>.
morozov commented on PR #24692:
URL: https://github.com/apache/flink/pull/24692#issuecomment-2310680036

   I copied the rate limiting example from `DataGenerator.java` to everywhere into the documentation. I also updated `DataGenerator.java` and renamed `generatorSource` to `source` for consistency with the rest of the documentation examples. For instance: https://github.com/apache/flink/blob/5217d50e58e6210e60c3e8a46ac948ccc7f0c901/docs/content/docs/connectors/datastream/datagen.md#L48-L49


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on code in PR #24692:
URL: https://github.com/apache/flink/pull/24692#discussion_r1732070723


##########
docs/content.zh/docs/connectors/datastream/datagen.md:
##########
@@ -65,14 +65,13 @@ Rate Limiting
 `Long` values at the overall source rate (across all source subtasks) not exceeding 100 events per second.
 
 ```java
-GeneratorFunction<Long, Long> generatorFunction = index -> index;
-double recordsPerSecond = 100;
+GeneratorFunction<Long, String> generatorFunction = index -> "Number: " + index;
 
 DataGeneratorSource<String> source =
         new DataGeneratorSource<>(
              generatorFunction,
              Long.MAX_VALUE,
-             RateLimiterStrategy.perSecond(recordsPerSecond),
+             RateLimiterStrategy.perSecond(4),

Review Comment:
   The `RateLimiterStrategy` value is not corresponding to the document.
   https://github.com/apache/flink/blob/5217d50e58e6210e60c3e8a46ac948ccc7f0c901/docs/content.zh/docs/connectors/datastream/datagen.md?plain=1#L64-L65



-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "flinkbot (via GitHub)" <gi...@apache.org>.
flinkbot commented on PR #24692:
URL: https://github.com/apache/flink/pull/24692#issuecomment-2067479443

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "4d0723dfc64326e5fab53b2b59c495f341a865df",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "4d0723dfc64326e5fab53b2b59c495f341a865df",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 4d0723dfc64326e5fab53b2b59c495f341a865df UNKNOWN
   
   <details>
   <summary>Bot commands</summary>
     The @flinkbot bot supports the following commands:
   
    - `@flinkbot run azure` re-run the last Azure build
   </details>


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "morozov (via GitHub)" <gi...@apache.org>.
morozov commented on PR #24692:
URL: https://github.com/apache/flink/pull/24692#issuecomment-2314127171

   @GOODBOY008, please see https://github.com/apache/flink/pull/25259.


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "snuyanzin (via GitHub)" <gi...@apache.org>.
snuyanzin commented on PR #24692:
URL: https://github.com/apache/flink/pull/24692#issuecomment-2308984427

   if we are talking about examples
   there is already existing one in examples module which is quite close to the one from description
   https://github.com/apache/flink/blob/4faf0966766e3734792f80ed66e512aa3033cacd/flink-examples/flink-examples-streaming/src/main/java/org/apache/flink/streaming/examples/datagen/DataGenerator.java#L36-L43
   
   how about having the same approach both in docs and in this example?
   


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "morozov (via GitHub)" <gi...@apache.org>.
morozov commented on code in PR #24692:
URL: https://github.com/apache/flink/pull/24692#discussion_r1732153194


##########
docs/content.zh/docs/connectors/datastream/datagen.md:
##########
@@ -65,14 +65,13 @@ Rate Limiting
 `Long` values at the overall source rate (across all source subtasks) not exceeding 100 events per second.
 
 ```java
-GeneratorFunction<Long, Long> generatorFunction = index -> index;
-double recordsPerSecond = 100;
+GeneratorFunction<Long, String> generatorFunction = index -> "Number: " + index;
 
 DataGeneratorSource<String> source =
         new DataGeneratorSource<>(
              generatorFunction,
              Long.MAX_VALUE,
-             RateLimiterStrategy.perSecond(recordsPerSecond),
+             RateLimiterStrategy.perSecond(4),

Review Comment:
   Good catch 🤦‍♂️ I updated `DataGenerator.java` with the value of `100` since it's used everywhere else.



-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on code in PR #24692:
URL: https://github.com/apache/flink/pull/24692#discussion_r1732070723


##########
docs/content.zh/docs/connectors/datastream/datagen.md:
##########
@@ -65,14 +65,13 @@ Rate Limiting
 `Long` values at the overall source rate (across all source subtasks) not exceeding 100 events per second.
 
 ```java
-GeneratorFunction<Long, Long> generatorFunction = index -> index;
-double recordsPerSecond = 100;
+GeneratorFunction<Long, String> generatorFunction = index -> "Number: " + index;
 
 DataGeneratorSource<String> source =
         new DataGeneratorSource<>(
              generatorFunction,
              Long.MAX_VALUE,
-             RateLimiterStrategy.perSecond(recordsPerSecond),
+             RateLimiterStrategy.perSecond(4),

Review Comment:
   The `RateLimiterStrategy` value is not corresponding to the comment.
   https://github.com/apache/flink/blob/5217d50e58e6210e60c3e8a46ac948ccc7f0c901/docs/content.zh/docs/connectors/datastream/datagen.md?plain=1#L40-L43



-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "morozov (via GitHub)" <gi...@apache.org>.
morozov commented on PR #24692:
URL: https://github.com/apache/flink/pull/24692#issuecomment-2309145899

   > how about having the same approach both in docs and in this example?
   
   @snuyanzin what exactly do you propose?


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 merged PR #24692:
URL: https://github.com/apache/flink/pull/24692


-- 
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-unsubscribe@flink.apache.org

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


Re: [PR] [FLINK-35177] Fix DataGen Connector documentation [flink]

Posted by "GOODBOY008 (via GitHub)" <gi...@apache.org>.
GOODBOY008 commented on code in PR #24692:
URL: https://github.com/apache/flink/pull/24692#discussion_r1733042779


##########
flink-connectors/flink-connector-datagen/src/main/java/org/apache/flink/connector/datagen/source/DataGeneratorSource.java:
##########
@@ -76,14 +76,14 @@
  * Long values at the overall source rate (across all source subtasks) of 100 events per second.

Review Comment:
   ```suggestion
    * String values at the overall source rate (across all source subtasks) of 100 events per second.
   ```



##########
docs/content.zh/docs/connectors/datastream/datagen.md:
##########
@@ -65,14 +65,13 @@ Rate Limiting
 `Long` values at the overall source rate (across all source subtasks) not exceeding 100 events per second.

Review Comment:
   ```suggestion
   `String` values at the overall source rate (across all source subtasks) not exceeding 100 events per second.
   ```



##########
docs/content/docs/connectors/datastream/datagen.md:
##########
@@ -65,14 +65,13 @@ Rate Limiting
 `Long` values at the overall source rate (across all source subtasks) not exceeding 100 events per second.

Review Comment:
   ```suggestion
   `String` values at the overall source rate (across all source subtasks) not exceeding 100 events per second.
   ```



-- 
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-unsubscribe@flink.apache.org

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