You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Clemens Valiente <cl...@grab.com> on 2024/06/10 03:15:39 UTC
How to Use AsyncLookupFunction
hi, how do I implement AsyncLookupFunctions correctly? I implemented a
AsyncLookupFunction, the eval function has the following signature:
https://nightlies.apache.org/flink/flink-docs-release-1.17/api/java/org/apache/flink/table/functions/AsyncLookupFunction.html
eval(CompletableFuture<Collection<RowData>> future, Object... keys) I also
implemented the Provider:
https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/table/connector/source/lookup/AsyncLookupFunctionProvider.html
unfortunately there is no documentation on the AsyncLookupFunction and
AsyncLookupFunctionProvider so I feel like I quite in the dark here.
if I register my AsyncLookupFunction as UDF and try to call it with this
example snippet:
WITH tbl AS (SELECT 123 as id, '456' as pmntid, 'IDR' as cur) SELECT * from
tbl join Lateral Table(cashlessInfo(id, pmntid, cur))
I get the following error:
No match found for function signature cashlessInfo(<NUMERIC>, <CHARACTER>,
<CHARACTER>)
I tried creating a DynamicTableSourceFactory and a Table that uses this one
similar to
https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sourcessinks/#full-stack-example
but I am not sure what schema to use here?
Any help/advice in which direction to investigate further?
--
By communicating with Grab Holdings Limited and/or its subsidiaries,
associate companies and jointly controlled entities (collectively, “Grab”),
you are deemed to have consented to the processing of your personal data as
set out in the Privacy Notice which can be viewed at
https://grab.com/privacy/ <https://grab.com/privacy/>
This email
contains confidential information that may be privileged and is only for
the intended recipient(s). If you are not the intended recipient(s), please
do not disseminate, distribute or copy this email. Please notify Grab
immediately if you have received this by mistake and delete this email from
your system. Email transmission may not be secure or error-free as any
information could be intercepted, corrupted, lost, destroyed, delayed or
incomplete, or contain viruses. Grab does not accept liability for any
errors or omissions in this email that arise as a result of email
transmission. All intellectual property rights in this email and any
attachments shall remain vested in Grab, unless otherwise provided by law
Re: How to Use AsyncLookupFunction
Posted by Krzysztof Chmielewski <kr...@gmail.com>.
Hi there Clenens.
This one might be a little bit tricky.
You can take a look: at
https://github.com/getindata/flink-http-connector/blob/main/src/main/java/com/getindata/connectors/http/internal/table/lookup/AsyncHttpTableLookupFunction.java
We implemented our http connector using assuncLookup there.
Hope that helps.
Best Regards,
Krzysztof
pon., 10 cze 2024, 07:46 użytkownik Clemens Valiente <
clemens.valiente@grab.com> napisał:
>
> hi, how do I implement AsyncLookupFunctions correctly? I implemented a
> AsyncLookupFunction, the eval function has the following signature:
> https://nightlies.apache.org/flink/flink-docs-release-1.17/api/java/org/apache/flink/table/functions/AsyncLookupFunction.html
> eval(CompletableFuture<Collection<RowData>> future, Object... keys) I also
> implemented the Provider:
> https://nightlies.apache.org/flink/flink-docs-master/api/java/org/apache/flink/table/connector/source/lookup/AsyncLookupFunctionProvider.html
> unfortunately there is no documentation on the AsyncLookupFunction and
> AsyncLookupFunctionProvider so I feel like I quite in the dark here.
> if I register my AsyncLookupFunction as UDF and try to call it with this
> example snippet:
>
> WITH tbl AS (SELECT 123 as id, '456' as pmntid, 'IDR' as cur) SELECT *
> from tbl join Lateral Table(cashlessInfo(id, pmntid, cur))
> I get the following error:
> No match found for function signature cashlessInfo(<NUMERIC>, <CHARACTER>,
> <CHARACTER>)
>
> I tried creating a DynamicTableSourceFactory and a Table that uses this
> one similar to
> https://nightlies.apache.org/flink/flink-docs-release-1.19/docs/dev/table/sourcessinks/#full-stack-example
> but I am not sure what schema to use here?
> Any help/advice in which direction to investigate further?
>
>
>
> By communicating with Grab Holdings Limited and/or its subsidiaries,
> associate companies and jointly controlled entities (collectively, “Grab”),
> you are deemed to have consented to the processing of your personal data as
> set out in the Privacy Notice which can be viewed at
> https://grab.com/privacy/ <https://grab.com/privacy/>
>
> This email contains confidential information that may be privileged and
> is only for the intended recipient(s). If you are not the intended
> recipient(s), please do not disseminate, distribute or copy this
> email. Please notify Grab immediately if you have received this by mistake
> and delete this email from your system. Email transmission may not be
> secure or error-free as any information could be intercepted, corrupted,
> lost, destroyed, delayed or incomplete, or contain viruses. Grab does not
> accept liability for any errors or omissions in this email that arise as a
> result of email transmission. All intellectual property rights in this
> email and any attachments shall remain vested in Grab, unless otherwise
> provided by law
>