Hi Michal,
Thanks for your comments.
To me at least it feels strange that something is called a function yet
> doesn't follow the functional interface definition of having just one
> abstract method. I suppose init and close could be made default methods
> with empty bodies once Java 7 support is dropped to mitigate that concern.
> Still, I feel some resistance to consider something that requires
> initialisation and closing (which implies holding state) as being a
> function. Sounds more like the Processor/Transformer kind of thing
> semantically, rather than a function.
- If we called the interface name only Function your assumptions will
hold. However, the keyword Rich by definition implies that we have a
function (as you described, with one abstract method and etc) but it is
rich. So, there are multiple methods in it.
Ideally it should be:
public interface RichFunction extends Function { // this is the
Function that you described
void close();
void init(Some params);
...
}
The KIP says there are multiple use-cases for this but doesn't enumerate
> any - I think some examples would be useful, otherwise that section sounds
> a little bit vague.
I thought it is obvious by definition but I will update it. Thanks.
IMHO, it's the access to the RecordContext is where the added value lies
> but maybe I'm just lacking in imagination, so I'm asking all this to better
> understand the rationale for init() and close().
Maybe I should add some examples. Thanks.
Cheers,
Jeyhun
On Mon, May 22, 2017 at 11:02 AM, Michal Borowiecki <
[email protected]> wrote:
> Hi Jeyhun,
>
> I'd like to understand better the premise of RichFunctions and why init(Some
> params), close() are said to be needed.
> To me at least it feels strange that something is called a function yet
> doesn't follow the functional interface definition of having just one
> abstract method. I suppose init and close could be made default methods
> with empty bodies once Java 7 support is dropped to mitigate that concern.
> Still, I feel some resistance to consider something that requires
> initialisation and closing (which implies holding state) as being a
> function. Sounds more like the Processor/Transformer kind of thing
> semantically, rather than a function.
>
> The KIP says there are multiple use-cases for this but doesn't enumerate
> any - I think some examples would be useful, otherwise that section sounds
> a little bit vague.
>
> IMHO, it's the access to the RecordContext is where the added value lies
> but maybe I'm just lacking in imagination, so I'm asking all this to better
> understand the rationale for init() and close().
>
> Thanks,
> MichaĆ
>
> On 20/05/17 17:05, Jeyhun Karimov wrote:
>
> Dear community,
>
> As we discussed in KIP-149 [DISCUSS] thread [1], I would like to initiate
> KIP for rich functions (interfaces) [2].
> I would like to get your comments.
>
>
> [1]http://search-hadoop.com/m/Kafka/uyzND1PMjdk2CslH12?subj=Re+DISCUSS+KIP+149+Enabling+key+access+in+ValueTransformer+ValueMapper+and+ValueJoiner
> [2]https://cwiki.apache.org/confluence/display/KAFKA/KIP-159%3A+Introducing+Rich+functions+to+Streams
>
>
> Cheers,
> Jeyhun
>
>
> --
> <http://www.openbet.com/> Michal Borowiecki
> Senior Software Engineer L4
> T: +44 208 742 1600 <+44%2020%208742%201600>
>
>
> +44 203 249 8448 <+44%2020%203249%208448>
>
>
>
> E: [email protected]
> W: www.openbet.com
> OpenBet Ltd
>
> Chiswick Park Building 9
>
> 566 Chiswick High Rd
>
> London
>
> W4 5XT
>
> UK
> <https://www.openbet.com/email_promo>
> This message is confidential and intended only for the addressee. If you
> have received this message in error, please immediately notify the
> [email protected] and delete it from your system as well as any
> copies. The content of e-mails as well as traffic data may be monitored by
> OpenBet for employment and security purposes. To protect the environment
> please do not print this e-mail unless necessary. OpenBet Ltd. Registered
> Office: Chiswick Park Building 9, 566 Chiswick High Road, London, W4 5XT,
> United Kingdom. A company registered in England and Wales. Registered no.
> 3134634. VAT no. GB927523612
>