Good problem... We were thinking for a while to make the input and output type serializers available from the RuntimeContext. That way you could call "T copy = serializer.copy(inValue)".
The "copy()" method on the copyable value is actually a good addition nonetheless! On Thu, Sep 17, 2015 at 10:31 PM, Greg Hogan <c...@greghogan.com> wrote: > What is best practice for handling Java type erasure in user defined > functions? Is there a means by which the TypeInformation can be accessed > from a RichFunction? My temporary solution was to add a "T copy()" method > to the CopyableValue interface. > > A common use case is a GroupReduceFunction that needs to collect objects. > With object reuse we need to make a copy and with type erasure we cannot > call new. > > Greg Hogan >