AlanConfluent commented on code in PR #24224:
URL: https://github.com/apache/flink/pull/24224#discussion_r1484927246


##########
docs/content/docs/dev/table/functions/udfs.md:
##########
@@ -846,6 +847,119 @@ If you intend to implement or call functions in Python, 
please refer to the [Pyt
 
 {{< top >}}
 
+Asynchronous Scalar Functions
+----------------
+
+A user-defined asynchronous scalar function maps zero, one, or multiple scalar 
values to a new scalar value, but does it asynchronously. Any data type listed 
in the [data types section]({{< ref "docs/dev/table/types" >}}) can be used as 
a parameter or return type of an evaluation method.
+
+In order to define an asynchronous scalar function, one has to extend the base 
class `AsyncScalarFunction` in `org.apache.flink.table.functions` and implement 
one or more evaluation methods named `eval(...)`.  The first argument must be a 
`CompletableFuture<...>` which is used to return the result, with subsequent 
arguments being the parameters passed to the function.
+
+The following example shows how to do work on a thread pool in the background, 
though any libraries exposing an async interface may be directly used to 
complete the `CompletableFuture` from a callback. See the [Implementation 
Guide](#implementation-guide) for more details.

Review Comment:
   I took a bunch of the introduction from that section.  I also adopted the 
diagram as well.
   
   I also added sections for each of those you mentioned and explained how it 
works, including citing specific configs and how they are used.
   
   It should make a lot of sense and be easy for new users to understand, I 
think.  If there are areas which require more detail, please tell me and I can 
add more.  I just didn't want to make it too verbose vs other UDF descriptions.



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

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

Reply via email to