PJ Van Aeken created FLINK-2033:
-----------------------------------
             Summary: 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
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)