Hi Aljoscha, Thank you for your answer!
Out of curiosity, would writing my own serializer involve implementing a serialisation for every your I could get? On Wed, Apr 1, 2020, 13:57 Aljoscha Krettek <aljos...@apache.org> wrote: > Hi Laurent! > > On 31.03.20 10:43, Laurent Exsteens wrote: > > Yesterday I managed to find another solution: create the type information > > outside of the class and pass it to the constructor. I can retrieve the > > type information from DataStream.getType() (whiich. This works well, and > is > > acceptable in my case. > > This is a valid solution which is also used internally in some parts of > Flink. > > > I'm starting to understand that the problem resides in Java Generics type > > erasure: we cannot create the TypeInformation using a TypeHint inside the > > Generic class, since creating the TypeHint is a runtime operation which > > cannot access the generic type anymore, since it has been erased at > compile > > time. > > Is my understanding correct? > > Yes, this seems correct. > > > > > I'm still interested by a solution where everything could be done inside > > the flatMap function, and without extra wrap and unwrap (although I'm > > starting to think that is not possible due to type erasure). > > It would be possible if you write your completely custom TypeSerializer, > but that is probably a lot more effort than it would be worth, > considering you also found the alternative solution. > > Best, > Aljoscha > -- ♻ Be green, keep it on the screen