Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Fixed
-
0.8.0, 0.9, 0.8.1
Description
It is currently impossible to use the TypeSerializerInputFormat with generic Tuple types.
For example, this example gist fails with a
Exception in thread "main" org.apache.flink.api.common.InvalidProgramException: The type returned by the input format could not be automatically determined. Please specify the TypeInformation of the produced type explicitly.
at org.apache.flink.api.java.ExecutionEnvironment.readFile(ExecutionEnvironment.java:341)
at SerializedFormatExample$.main(SerializedFormatExample.scala:48)
at SerializedFormatExample.main(SerializedFormatExample.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
exaception.
To fix the issue, I changed the constructor to take a TypeInformation<T> instad of a TypeSerializer<T> argument. If this is indeed a bug, I think that this is a good solution.
Unfortunately the fix breaks the API. Feel free to change it if you find a more elegant solution compatible with the 0.8 branch.
The suggested fix can be found in the GitHub PR#349.