[ 
https://issues.apache.org/jira/browse/FLINK-2023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14547747#comment-14547747
 ] 

PJ Van Aeken commented on FLINK-2023:
-------------------------------------

So this works, I'm just not entirely sure this is what you meant :

I extended the java Gelly API with a method like the one below so I can 
explicitely pass all TypeInformation:

    public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, 
NV> mapper, TypeInformation<K> keyType, TypeInformation<NV> valueType, 
TypeInformation<Vertex<K, NV>> returnType) {
        DataSet<Vertex<K, NV>> mappedVertices = vertices.map(
                new MapFunction<Vertex<K, VV>, Vertex<K, NV>>() {
                    public Vertex<K, NV> map(Vertex<K, VV> value) throws 
Exception {
                        return new Vertex<K, NV>(value.f0, mapper.map(value));
                    }
                }).returns(returnType);

        return new Graph<K, NV, EV>(mappedVertices, this.edges, this.context);
    }

I then call this method in the Scala API like this :

new Graph[K, NV, EV](jgraph.mapVertices[NV](
            mapper,
            createTypeInformation[K],
            createTypeInformation[NV],
            createTypeInformation[Vertex[K, NV]]
        ))

> TypeExtractor does not work for (some) Scala Classes
> ----------------------------------------------------
>
>                 Key: FLINK-2023
>                 URL: https://issues.apache.org/jira/browse/FLINK-2023
>             Project: Flink
>          Issue Type: Bug
>          Components: Type Serialization System
>            Reporter: Aljoscha Krettek
>
> [~vanaepi] discovered some problems while working on the Scala Gelly API 
> where, for example, a Scala MapFunction can not be correctly analyzed by the 
> type extractor. For example, generic types will not be correctly detected.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to