You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "dianfu (via GitHub)" <gi...@apache.org> on 2025/11/03 07:43:07 UTC

[PR] [FLINK-38615][python] Optimize AsyncFunction to remove ResultFuture [flink]

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

   
   ## What is the purpose of the change
   
   * This pull request optimizes AsyncFunction interface to remove ResultFuture. *
   
   ## Brief change log
   
     - *Removes ResultFuture from the signature of AsyncFunction *
   
   ## Verifying this change
   
   This change is already covered by existing tests in test_async_function.py*.
   
   
   ## Does this pull request potentially affect one of the following parts:
   
     - Dependencies (does it add or upgrade a dependency): (yes / no)
     - The public API, i.e., is any changed class annotated with `@Public(Evolving)`: (yes / no)
     - The serializers: (yes / no / don't know)
     - The runtime per-record code paths (performance sensitive): (yes / no / don't know)
     - Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: (yes / no / don't know)
     - The S3 file system connector: (yes / no / don't know)
   
   ## Documentation
   
     - Does this pull request introduce a new feature? (yes / no)
     - If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
   


-- 
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-38615][python] Optimize AsyncFunction to remove ResultFuture [flink]

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


-- 
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-38615][python] Optimize AsyncFunction to remove ResultFuture [flink]

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


##########
flink-python/pyflink/datastream/functions.py:
##########
@@ -979,68 +978,32 @@ def exponential_backoff(
             result_predicate, exception_predicate)
 
 
-class ResultFuture(Generic[OUT]):
-    """

Review Comment:
   I think we should deprecate the old API and introduce this, in this way exiting applications will not break and the older API version can be managed out. This is less a consideration for master - but is a consideration for the backports.  



-- 
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-38615][python] Optimize AsyncFunction to remove ResultFuture [flink]

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


##########
flink-python/pyflink/datastream/functions.py:
##########
@@ -979,68 +978,32 @@ def exponential_backoff(
             result_predicate, exception_predicate)
 
 
-class ResultFuture(Generic[OUT]):
-    """

Review Comment:
   @davidradl Good point! This is introduced in Flink 2.2 and so there is no backward compatibility issues. 



-- 
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-38615][python] Optimize AsyncFunction to remove ResultFuture [flink]

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

   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-38615][python] Optimize AsyncFunction to remove ResultFuture [flink]

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


##########
flink-python/pyflink/datastream/functions.py:
##########
@@ -979,68 +978,32 @@ def exponential_backoff(
             result_predicate, exception_predicate)
 
 
-class ResultFuture(Generic[OUT]):
-    """

Review Comment:
   @davidradl This is introduced in Flink 2.2 and so there is no backward compatibility issues. 



-- 
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-38615][python] Optimize AsyncFunction to remove ResultFuture [flink]

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


##########
flink-python/pyflink/datastream/functions.py:
##########
@@ -979,68 +978,32 @@ def exponential_backoff(
             result_predicate, exception_predicate)
 
 
-class ResultFuture(Generic[OUT]):
-    """

Review Comment:
   @davidradl Good point! This is introduced in Flink 2.2 and so there is no backward compatibility issues (I'd like to make sure this is merged into Flink 2.2). 



-- 
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-38615][python] Optimize AsyncFunction to remove ResultFuture [flink]

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

   <!--
   Meta data
   {
     "version" : 1,
     "metaDataEntries" : [ {
       "hash" : "3fbf8f508c8a200feaf577f78eb29e8e19c4c30b",
       "status" : "UNKNOWN",
       "url" : "TBD",
       "triggerID" : "3fbf8f508c8a200feaf577f78eb29e8e19c4c30b",
       "triggerType" : "PUSH"
     } ]
   }-->
   ## CI report:
   
   * 3fbf8f508c8a200feaf577f78eb29e8e19c4c30b 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-38615][python] Optimize AsyncFunction to remove ResultFuture [flink]

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


##########
flink-python/pyflink/fn_execution/datastream/process/async_function/operation.py:
##########


Review Comment:
   As we get rid of 'result_future' in the `AsyncFunction`, we may change the error description here as well when users return non-iterable result



##########
flink-python/pyflink/datastream/tests/test_async_function.py:
##########
@@ -54,12 +54,12 @@ def test_unordered_mode(self):
 
         class MyAsyncFunction(AsyncFunction):
 
-            async def async_invoke(self, value: Row, result_future: ResultFuture[int]):
+            async def async_invoke(self, value: Row):
                 await asyncio.sleep(2)
-                result_future.complete([value[0] + value[1]])
+                return [value[0] + value[1]]

Review Comment:
   I modify the test a little to `return None` and I find that the test can run without throwing `The 'result_future' of AsyncFunction should be completed with ...` exception.
   Is that expected? 



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