You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "PJ Van Aeken (JIRA)" <ji...@apache.org> on 2015/06/10 10:33:00 UTC

[jira] [Commented] (FLINK-2033) Add overloaded methods with explicit TypeInformation parameters to Gelly

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

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

If the PR for FLINK-1962 gets accepted, this can be marked as resolved

> Add overloaded methods with explicit TypeInformation parameters to Gelly
> ------------------------------------------------------------------------
>
>                 Key: FLINK-2033
>                 URL: https://issues.apache.org/jira/browse/FLINK-2033
>             Project: Flink
>          Issue Type: Task
>          Components: Gelly
>    Affects Versions: 0.9
>            Reporter: PJ Van Aeken
>            Assignee: PJ Van Aeken
>
> For the implementation of the Scala API for Gelly (FLINK-1962), we need to pass explicit TypeInformation since the Java TypeExtractor does not work for all Scala Types (see FLINK-2023).
> To do this, the java Gelly API needs to be expanded with methods that allow for explicit passing of TypeInformation.
> An example with mapVertices:
> {code}
>  public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper) {
>         TypeInformation<K> keyType = ((TupleTypeInfo<?>) vertices.getType()).getTypeAt(0);
>         String callLocation = Utils.getCallLocationName();
>         TypeInformation<NV> valueType = TypeExtractor.getMapReturnTypes(mapper, vertices.getType(), callLocation, false);
>         TypeInformation<Vertex<K, NV>> returnType = (TypeInformation<Vertex<K, NV>>) new TupleTypeInfo(
>                 Vertex.class, keyType, valueType);
>         return mapVertices(mapper,returnType);
>     }
>     public <NV> Graph<K, NV, EV> mapVertices(final MapFunction<Vertex<K, VV>, NV> mapper, 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);
>     }
> {code}



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