[
https://issues.apache.org/jira/browse/BEAM-7778?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16896535#comment-16896535
]
Andrew Pilloud commented on BEAM-7778:
--------------------------------------
Calcite handles this for us, but we expect UDFs to be stateless. If your UDF
has a static eval method it will just call the method, otherwise it will
instantiate the class every time to ensure a consistent state. The first
example in our documentation shows a static UDF.
[https://beam.apache.org/documentation/dsls/sql/extensions/user-defined-functions/]
> a new UDF object is constructed every time there is a message
> -------------------------------------------------------------
>
> Key: BEAM-7778
> URL: https://issues.apache.org/jira/browse/BEAM-7778
> Project: Beam
> Issue Type: Bug
> Components: dsl-sql
> Reporter: Yang Zhang
> Priority: Major
>
> Hello Beamers, I want to ask a question about Beam SQL UDF. When I use the
> following statement to register UDF and execute sql,
> {code:java}
> SqlTransform.query("select capitalize([field]) from [bounded] right join
> [unbounded] on [condition]").registerUdf("capitalize", new
> SqlUDF.CapitalizeStringFn()));{code}
> from my observation, every time there is an incoming message, a new UDF
> object is constructed. Is there a way to make this UDF object to be just
> created once instead of unlimited times? Thank you very much!
>
--
This message was sent by Atlassian JIRA
(v7.6.14#76016)