[
https://issues.apache.org/jira/browse/FLINK-18280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17265803#comment-17265803
]
Robert Metzger commented on FLINK-18280:
----------------------------------------
Cool! Thanks for sharing.
I would recommend you to submit this to https://flink-packages.org/ as well,
for increased visibility!
> Kotlin adapters for Flink types?
> --------------------------------
>
> Key: FLINK-18280
> URL: https://issues.apache.org/jira/browse/FLINK-18280
> Project: Flink
> Issue Type: Wish
> Components: API / DataStream
> Affects Versions: 1.10.1
> Reporter: Marshall Pierce
> Priority: Minor
>
> Currently, using a Kotlin lambda for, say, a {{KeySelector}} doesn't work –
> it needs to be an {{object}} expression for the runtime type detection to
> work. At my day job we have started building up a handful of wrappers, like
> this one for {{KeySelector}}:
> {code}
> inline fun <T, K> keySelector(crossinline block: (T) -> K): KeySelector<T, K>
> {
> return object : KeySelector<T, K> {
> override fun getKey(value: T): K {
> return block(value)
> }
> }
> }
> {code}
> Usage looks like: {code}keySelector { it.fooId }{code}
> Surely not the only way to solve that problem, but it's been working smoothly
> for us so far.
> Is there any interested in shipping these sorts of extensions as part of the
> Flink project so users don't need to write them? It could be a wholly
> separate artifact (or rather multiple artifacts, as there would probably be
> one for flink core, one for flink streaming, etc).
--
This message was sent by Atlassian Jira
(v8.3.4#803005)