...
The primary public class is AsyncScalarFunction, for being the base class of all async scalar functions. The
The type is parameterized with a return type for the eval call. This is similar to the definition of AsyncTableFunction.
...
As with the standard ScalarFunction, there is an eval method with a 0th parameter of the type CompletableFuture<String> future. This
This is the primary method used to invoke the async functionality.
...
One of the areas that have been used as inspiration for planner changes are the python calc rules. Most of the split rules (rules for complex calc nodes being split into multiple simpler calc nodes) will be generalized and
shared between the two, since remote python calls and async calls more generally share much of the same structure. If done correctly, the intention is to simplify the async operator to handle only FlinkLogicalCalcs
which contain async UDF calls in projections and no other calc logic (non async calls, field accesses, conditions). The
The high level motivation is that anything that comes after an async call is easier to chain as a series of operators rather than internally within a single operator.
...
This will allow for PythonCalcCallFinder and AsyncCalcCallFinder implementations.
The rules we intend to adopt split up a FlinkLogicalCalc into two (or more ultimately) FlinkLogicalCalcs which feed into one another. The async split rules shared with Python will be:
Rule | Original RelNode | Becomes (Bottom ==> Top) |
---|---|---|
SPLIT_CONDITION Splits FlinkLogicalCalcs which contain Remote functions in the condition into |
|
==>
|
SPLIT_PROJECT Splits projections with async functions and non async |
|
==>
|
SPLIT_PROJECTION_REX_FIELD Splits field accesses from the result of an async call in projections |
|
==>
|
SPLIT_CONDITION_REX_FIELD Splits field accesses from the result of an async call in condition |
|
==>
|
EXPAND_PROJECT Splits field accesses as inputs to async calls into two FlinkLogicalCalcs. |
|
==>
|
PUSH_CONDITION Pushes conditions down to minimize rows requiring the async call, |
|
==>
|
Async Specific: NESTED_SPLIT If there is a call with an async call as an argument, then it needs to be split |
|
==>
|
Disallowing Async functionality when not supported
...