flink-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Alexandrov <alexander.s.alexand...@gmail.com>
Subject Re: Allow TypeInfofactory regisration via ExecutionConfig
Date Sat, 08 Oct 2016 14:20:08 GMT
To follow up on my on post,

I think a straight-forward approach would be to make the
`TypeExtractor.registerFactory` method public [1].

BTW, both the TypeInfo annotation [2] and TypeInfoFactory [3] itself refer
to this method in the JavaDoc. However, besides these mentions I was not
able to find any actual usage of `registerFactory` in the Flink codebase,
so I am not sure when and where the method is actually invoked to register
the annotated classes.


On Sat, Oct 8, 2016 at 4:00 PM Alexander Alexandrov <
alexander.s.alexandrov@gmail.com> wrote:

I wanted to open this directly as a JIRA to follow-up on FLINK-3042,
however my account (aalexandrov) does not seem to have the necessary
privileges, so I will post this to the dev list instead.

The current approach for registration of custom `TypeInformation`
implementations which relies exclusively on annotations. Consequently, it
will be very tedious to create a custom `TypeInformation` for types that
are pulled and used within a project from an external library.

For example, if  I have a project structure such as

my-project      // uses FancyContainer<A>
 `- flink-core
 `- ext-library // defines FancyContainer<A>

I will not be able to modify `FancyContainer.java`.

A workaround that might work (I have not tested it yet) is to use
`javassist` to attach the annotation prior to job assembly, but IMHO a much
clearer solution would be to extend the `ExecutionEnvironment` with
something like

env.getConfig().registerTypeInfoFactory(Class<?> type, Class<? extends
TypeInfofactory<?>> factory)


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message