GitHub user aalexandrov opened a pull request:

    https://github.com/apache/flink/pull/349

    Added ResultTypeQueryable interface to TypeSerializerInputFormat.

    It is currently impossible to use the `TypeSerializerInputFormat` with 
generic Tuple types.
    
    For example, [this example 
gist](https://gist.github.com/aalexandrov/90bf21f66bf604676f37) 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.   

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aalexandrov/flink 
typeserializerinputformat_fix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/flink/pull/349.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #349
    
----
commit 2c1816640574c182f3b9f556ec5bab5df6f56f2c
Author: Alexander Alexandrov <alexander.s.alexand...@gmail.com>
Date:   2015-01-29T14:41:01Z

    Added ResultTypeQueryable interface implementation to 
TypeSerializerInputFormat.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to