Marshall Pierce created FLINK-18280:
---------------------------------------
Summary: Kotlin adapters for Flink types?
Key: FLINK-18280
URL:
https://issues.apache.org/jira/browse/FLINK-18280 Project: Flink
Issue Type: Wish
Affects Versions: 1.10.1
Reporter: Marshall Pierce
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:kotlin}
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: {{keySelector { it.fooId }}}. 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)