You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "Hisoka-X (via GitHub)" <gi...@apache.org> on 2023/09/15 09:57:55 UTC

[GitHub] [seatunnel] Hisoka-X opened a new pull request, #5502: [Feature] Support flow control in zeta

Hisoka-X opened a new pull request, #5502:
URL: https://github.com/apache/seatunnel/pull/5502

   <!--
   
   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/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
   1. Add `SourceReceivedBytes`, `SourceReceivedBytesPerSeconds`, `SinkWriteBytes`, `SinkWriteBytesPerSeconds` as new bytes metrics.
   2. Add new config `read_limit.rows_per_second` and `read_limit.bytes_per_second` to limit read speed. Only work on Zeta at now.
   
   <!-- Describe the purpose of this pull request. For example: This pull request adds checkstyle plugin.-->
   
   ## Check list
   
   * [ ] Code changed are covered with tests, or it does not need tests for reason:
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
   * [ ] If you are contributing the connector code, please check that the following files are updated:
     1. Update change log that in connector document. For more details you can refer to [connector-v2](https://github.com/apache/seatunnel/tree/dev/docs/en/connector-v2)
     3. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     4. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
   * [ ] Update the [`release-note`](https://github.com/apache/seatunnel/blob/dev/release-note.md).


-- 
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] [seatunnel] hailin0 commented on pull request #5502: [Feature] Support flow control in zeta

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on PR #5502:
URL: https://github.com/apache/seatunnel/pull/5502#issuecomment-1721172292

   check ci error


-- 
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] [seatunnel] hailin0 commented on a diff in pull request #5502: [Feature] Support flow control in zeta

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on code in PR #5502:
URL: https://github.com/apache/seatunnel/pull/5502#discussion_r1327200132


##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/SeaTunnelRow.java:
##########
@@ -97,6 +100,180 @@ public boolean isNullAt(int pos) {
         return this.fields[pos] == null;
     }
 
+    public int getBytesSize(SeaTunnelRowType rowType) {
+        if (size == 0) {
+            int s = 0;
+            for (int i = 0; i < fields.length; i++) {
+                s += getBytesForValue(fields[i], rowType.getFieldType(i));
+            }
+            size = s;
+        }
+        return size;
+    }
+
+    /** faster version of {@link #getBytesSize(SeaTunnelRowType)}. */
+    private int getBytesForValue(Object v, SeaTunnelDataType<?> dataType) {
+        if (v == null) {
+            return 0;
+        }
+        SqlType sqlType = dataType.getSqlType();
+        switch (sqlType) {
+            case STRING:
+                return ((String) v).length();

Review Comment:
   +1
   



-- 
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] [seatunnel] hailin0 merged pull request #5502: [Feature] Support flow control in zeta

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


-- 
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] [seatunnel] hailin0 commented on pull request #5502: [Feature] Support flow control in zeta

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on PR #5502:
URL: https://github.com/apache/seatunnel/pull/5502#issuecomment-1721013927

   Please add usage documentation


-- 
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] [seatunnel] Hisoka-X commented on pull request #5502: [Feature] Support flow control in zeta

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #5502:
URL: https://github.com/apache/seatunnel/pull/5502#issuecomment-1721037724

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

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


[GitHub] [seatunnel] ruanwenjun commented on a diff in pull request #5502: [Feature] Support flow control in zeta

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #5502:
URL: https://github.com/apache/seatunnel/pull/5502#discussion_r1327175511


##########
seatunnel-api/src/main/java/org/apache/seatunnel/api/table/type/SeaTunnelRow.java:
##########
@@ -97,6 +100,180 @@ public boolean isNullAt(int pos) {
         return this.fields[pos] == null;
     }
 
+    public int getBytesSize(SeaTunnelRowType rowType) {
+        if (size == 0) {
+            int s = 0;
+            for (int i = 0; i < fields.length; i++) {
+                s += getBytesForValue(fields[i], rowType.getFieldType(i));
+            }
+            size = s;
+        }
+        return size;
+    }
+
+    /** faster version of {@link #getBytesSize(SeaTunnelRowType)}. */
+    private int getBytesForValue(Object v, SeaTunnelDataType<?> dataType) {
+        if (v == null) {
+            return 0;
+        }
+        SqlType sqlType = dataType.getSqlType();
+        switch (sqlType) {
+            case STRING:
+                return ((String) v).length();

Review Comment:
   `length` does not return byte length, it will return the unique code length.
   But it seems we don't  have a better way to get the byte length.



-- 
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] [seatunnel] Hisoka-X commented on pull request #5502: [Feature] Support flow control in zeta

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #5502:
URL: https://github.com/apache/seatunnel/pull/5502#issuecomment-1722079147

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

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