You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Sxnan (via GitHub)" <gi...@apache.org> on 2023/06/29 03:08:52 UTC

[GitHub] [flink] Sxnan opened a new pull request, #22897: [FLINK-32476][runtime] Support configuring object-reuse for internal operators

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

   ## What is the purpose of the change
   
   This PR allows the internal operators to report whether the operators will modify the input so that Flink can decide whether to enable object-reuse for the operators. 
   
   ## Brief change log
   
   - Add an internal method to `StreamOperator` to allow implementations to report whether the operator will modify the input.
   - Update the internal SQL and DataStream operators to overwrite the method accordingly.
   
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - Add tests that validate the object reuse behavior in `StreamOperatorChainingTest.java`.
   
   ## 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)`: yes
     - 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


[GitHub] [flink] flinkbot commented on pull request #22897: [FLINK-32476][runtime] Support configuring object-reuse for internal operators

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "96a57bc9a2afa4e8af42fdcb9a454b96dfef6055",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "96a57bc9a2afa4e8af42fdcb9a454b96dfef6055",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 96a57bc9a2afa4e8af42fdcb9a454b96dfef6055 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


[GitHub] [flink] lindong28 commented on a diff in pull request #22897: [FLINK-32476][runtime] Support configuring object-reuse for internal operators

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


##########
flink-core/src/main/java/org/apache/flink/api/common/functions/Function.java:
##########
@@ -27,4 +28,17 @@
  * method) interfaces that can be implemented via Java 8 lambdas.
  */
 @Public
-public interface Function extends java.io.Serializable {}
+public interface Function extends java.io.Serializable {
+
+    /**
+     * Whether the function will modify the input records inplace. By default, this method return
+     * true for safety reason. If the function doesn't modify the input data, it should overwrite
+     * this method to return false for better performance.
+     *
+     * @return Whether the function will modify the input data inplace.
+     */
+    @Internal
+    default boolean willModifyInput() {

Review Comment:
   It is probably incorrect to say "Whether the function will modify the input records inplace". This is because this method is allowed to return true even if "the function does not modify the input records inplace".
   
   Also note that we should be able to support object-reuse even if the function modify input, as long as the function do not cache/modify those records that have already been emitted.
   
   ```
   /**
    * If this method returns true, it is guaranteed that this function will not
    * cache/modify those records that it has previously emitted.
    */
   @Internal
   default boolean enableObjectReuse() {
       return false;
   }
   ```



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


[GitHub] [flink] Sxnan commented on pull request #22897: [FLINK-32476][runtime] Support configuring object-reuse for internal operators

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

   @flinkbot run azure


-- 
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-32476][runtime] Support configuring object-reuse for internal operators [flink]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #22897: [FLINK-32476][runtime] Support configuring object-reuse for internal operators
URL: https://github.com/apache/flink/pull/22897


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


[GitHub] [flink] lindong28 commented on a diff in pull request #22897: [FLINK-32476][runtime] Support configuring object-reuse for internal operators

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


##########
flink-core/src/main/java/org/apache/flink/api/common/functions/Function.java:
##########
@@ -27,4 +28,17 @@
  * method) interfaces that can be implemented via Java 8 lambdas.
  */
 @Public
-public interface Function extends java.io.Serializable {}
+public interface Function extends java.io.Serializable {
+
+    /**
+     * Whether the function will modify the input records inplace. By default, this method return
+     * true for safety reason. If the function doesn't modify the input data, it should overwrite
+     * this method to return false for better performance.
+     *
+     * @return Whether the function will modify the input data inplace.
+     */
+    @Internal
+    default boolean willModifyInput() {

Review Comment:
   It is probably not correct to say "Whether the function will modify the input records inplace". This is because this method is allowed to return true even if "the function does not modify the input records inplace".
   
   Also note that we should be able to support object-reuse even if the function modify input, as long as the function do not cache/modify those records that have already been emitted.
   
   ```
   /**
    * If this method returns true, it is guaranteed that this function will not
    * cache/modify those records that it has previously emitted.
    */
   @Internal
   default boolean enableObjectReuse() {
       return false;
   }
   ```



-- 
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-32476][runtime] Support configuring object-reuse for internal operators [flink]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22897:
URL: https://github.com/apache/flink/pull/22897#issuecomment-2595360624

   This PR is being marked as stale since it has not had any activity in the last 180 days. 
   If you would like to keep this PR alive, please leave a comment asking for a review. 
   If the PR has merge conflicts, update it with the latest from the base branch.
   
   If you are having difficulty finding a reviewer, please reach out to the 
   community, contact details can be found here: https://flink.apache.org/what-is-flink/community/
   
   If this PR is no longer valid or desired, please feel free to close it. 
   If no activity occurs in the next 90 days, it will be automatically closed.


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


[GitHub] [flink] lindong28 commented on a diff in pull request #22897: [FLINK-32476][runtime] Support configuring object-reuse for internal operators

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


##########
flink-core/src/main/java/org/apache/flink/api/common/functions/Function.java:
##########
@@ -27,4 +28,17 @@
  * method) interfaces that can be implemented via Java 8 lambdas.
  */
 @Public
-public interface Function extends java.io.Serializable {}
+public interface Function extends java.io.Serializable {
+
+    /**
+     * Whether the function will modify the input records inplace. By default, this method return
+     * true for safety reason. If the function doesn't modify the input data, it should overwrite
+     * this method to return false for better performance.
+     *
+     * @return Whether the function will modify the input data inplace.
+     */
+    @Internal
+    default boolean willModifyInput() {

Review Comment:
   It is probably incorrect to say "Whether the function will modify the input records inplace". This is because this method is allowed to return true even if "the function does not modify the input records inplace".
   
   Also note that we should be able to support object-reuse even if the function modify input, as long as the function do not cache/modify those records that have already been emitted.
   
   ```
   /**
    * If this method returns true, it is guaranteed that this function will not
    * cache/modify those records that it has previously emitted.
    */
   @Internal
   default boolean isObjctResuseCompliant() {
       return false;
   }
   ```



##########
flink-core/src/main/java/org/apache/flink/api/common/functions/Function.java:
##########
@@ -27,4 +28,17 @@
  * method) interfaces that can be implemented via Java 8 lambdas.
  */
 @Public
-public interface Function extends java.io.Serializable {}
+public interface Function extends java.io.Serializable {
+
+    /**
+     * Whether the function will modify the input records inplace. By default, this method return
+     * true for safety reason. If the function doesn't modify the input data, it should overwrite
+     * this method to return false for better performance.
+     *
+     * @return Whether the function will modify the input data inplace.
+     */
+    @Internal
+    default boolean willModifyInput() {

Review Comment:
   It is probably incorrect to say "Whether the function will modify the input records inplace". This is because this method is allowed to return true even if "the function does not modify the input records inplace".
   
   Also note that we should be able to support object-reuse even if the function modify input, as long as the function do not cache/modify those records that have already been emitted.
   
   ```
   /**
    * If this method returns true, it is guaranteed that this function will not
    * cache/modify those records that it has previously emitted.
    */
   @Internal
   default boolean isObjectResuseCompliant() {
       return false;
   }
   ```



-- 
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-32476][runtime] Support configuring object-reuse for internal operators [flink]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #22897:
URL: https://github.com/apache/flink/pull/22897#issuecomment-2774619612

   This PR has been closed since it has not had any activity in 120 days. 
   If you feel like this was a mistake, or you would like to continue working on it, 
   please feel free to re-open the PR and ask for a review.


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