You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Robert Metzger (Jira)" <ji...@apache.org> on 2020/07/22 14:08:00 UTC
[jira] [Updated] (FLINK-18280) Kotlin adapters for Flink types?
[ https://issues.apache.org/jira/browse/FLINK-18280?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Robert Metzger updated FLINK-18280:
-----------------------------------
Component/s: API / DataStream
> 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)