cyberdelia / flink-kotlin

Kotlin support for Apache Flink

Home Page:https://github.com/cyberdelia/flink-kotlin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about null fields

pedroteixeira opened this issue · comments

Any particular reason why "Null fields are not supported"?
Any plans to support them?

Thanks,
Pedro

Hi, I came across this same issue... I understand this is a Flink limitation when using tuples, but:

  • How can we deal with nullable fields in Kotlin data classes? I think most non-trivial use cases would require some way to do so
  • Could TypeInfo for data classes be somehow modeled as a subclass of PojoTypeInfo instead of TupleTypeInfoBase? Flink documentation doesn't state POJOs have this same not-null limitation as Tuples do

PS: sorry to bring this up again, but seemed better to open a new issue

You can model nullable values as a distinct type that isn't nilable.

Right, I thought that too. I tried using Java's Optional, but this can only be serialized via Flink Kryo fallback, which is not desirable. Do you see a better approach?