[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15754052#comment-15754052 ] ASF GitHub Bot commented on FLINK-5097: --- Github user asfgit closed the pull request at: https://github.com/apache/flink/pull/2842 > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15752120#comment-15752120 ] ASF GitHub Bot commented on FLINK-5097: --- Github user vasia commented on the issue: https://github.com/apache/flink/pull/2842 Done. I'll wait for travis, then merge. > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15751854#comment-15751854 ] ASF GitHub Bot commented on FLINK-5097: --- Github user vasia commented on the issue: https://github.com/apache/flink/pull/2842 Sure, I can revert using `getMapReturnTypes` , rebase, and merge. > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15751615#comment-15751615 ] ASF GitHub Bot commented on FLINK-5097: --- Github user greghogan commented on the issue: https://github.com/apache/flink/pull/2842 @vasia, as this PR fixes the reported issue, should we rebase and commit for 1.2 and leave the remaining updates for a separate ticket? > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15728099#comment-15728099 ] ASF GitHub Bot commented on FLINK-5097: --- Github user vasia commented on the issue: https://github.com/apache/flink/pull/2842 Hi @twalthr, thank you so much for looking into this. I'll create an issue for functions with > 2 inputs. I have replaced `createTypeInfo` with `getMapReturnTypes` where possible, but I'm getting a test failure now that I can't figure out. Please see `org.apache.flink.graph.scala.test.operations.GraphCreationWithCsvITCase#testCsvWithMapperValues`. Am I using the `getMapReturnTypes` method properly? > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15712056#comment-15712056 ] ASF GitHub Bot commented on FLINK-5097: --- Github user twalthr commented on the issue: https://github.com/apache/flink/pull/2842 @vasia You are right. The `TypeExtractor` doesn't support functions with more than 2 inputs. That has never been required so far as the runtime operators always have two inputs. You could open an issue for that if this feature makes sense. `TypeExtractor.getMapReturnTypes` has support for Java 8 lambdas and checks for the `ResultTypeQueryable` interface first, so I would use the more specific `getXXXReturnTypes` (the plural has historic reasons) method if possible and the generic `createTypeInfo` method otherwise. Just make sure that you don't set the `allowMissing` flag otherwise you might get a `MissingTypeInfo` back. > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15687902#comment-15687902 ] ASF GitHub Bot commented on FLINK-5097: --- Github user greghogan commented on the issue: https://github.com/apache/flink/pull/2842 @vasia should `Graph` be using the function specific `TypeExtractor.getMapReturnTypes` (not sure why this is plural) and similar where core Functions are used? For `Gelly` functions, I think you are right that this capability is lacking, i.e. `NeighborsFunctionWithVertexValue` has three input types and `TypeExtractor` only provides `getUnaryOperatorReturnType` and `getBinaryOperatorReturnType`? It also looks like `TypeExtractor` expects a specific though natural ordering (input types before output types). @twalthr what do you recommend? > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15686757#comment-15686757 ] ASF GitHub Bot commented on FLINK-5097: --- Github user vasia commented on the issue: https://github.com/apache/flink/pull/2842 Hi @greghogan, I was able to fix the problem in `fromDataSet()` and `groupReduceOnEdges()` with `EdgesFunction`. In the rest of the uses, I don't seem to find a way to pass all the input types correctly. The remaining cases all have 3 input types and the `createTypeInfo()` method only accepts two. I have also tried extracting the input types from the wrapping functions, but that didn't work either. Any ideas? > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15684040#comment-15684040 ] ASF GitHub Bot commented on FLINK-5097: --- Github user vasia commented on the issue: https://github.com/apache/flink/pull/2842 Thanks! Let me look into these and I'll get back to you. > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15684009#comment-15684009 ] ASF GitHub Bot commented on FLINK-5097: --- Github user greghogan commented on the issue: https://github.com/apache/flink/pull/2842 I count nine uses of `TypeExtractor.createTypeInfo` in `Graph` and one each in `ScatterGatherIteration`, `VertexCentricIteration`, and `GatherSumApplyIteration`. The latter still need to allow for the UDF to implement `ResultTypeQueryable`. For example, won't `ScatterGatherIteration` type extraction currently fail on a `ScatterFunction` where the `Message` type is based on `K`, 'VV`, or `EV`? > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15683964#comment-15683964 ] ASF GitHub Bot commented on FLINK-5097: --- Github user vasia commented on the issue: https://github.com/apache/flink/pull/2842 @greghogan if the input types are known, we should pass them, yes. What other cases did you find? > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15683952#comment-15683952 ] ASF GitHub Bot commented on FLINK-5097: --- Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/2842#discussion_r88926689 --- Diff: flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java --- @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.test.operations; + +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.api.java.typeutils.TupleTypeInfo; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.test.TestGraphUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +public class TypeExtractorTest { + + private GraphinputGraph; + + + @Before + public void setUp() throws Exception { + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + DataSet > vertices = TestGraphUtils.getLongLongVertexData(env); + DataSet > edges = TestGraphUtils.getLongLongEdgeData(env); + inputGraph = Graph.fromDataSet(vertices, edges, env); + } + + public class TestGraphWithGeneric { + + public DataSet >> mapVertices(Graph input) { + return input.mapVertices(new VertexMapper()).getVertices(); + } + + public DataSet >> mapEdges(Graph input) { + return input.mapEdges(new EdgeMapper()).getEdges(); + } + } + + @Test + public void testMapVerticesType() throws Exception { + TestGraphWithGeneric test = new TestGraphWithGeneric<>(); + + // test type extraction in mapVertices + DataSet >> outVertices = test.mapVertices(inputGraph); + Assert.assertEquals(true, (new TupleTypeInfo(Vertex.class, BasicTypeInfo.LONG_TYPE_INFO, + new TupleTypeInfo >(BasicTypeInfo.LONG_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO))) + .equals(outVertices.getType())); + } + + @Test + public void testMapEdgesType() throws Exception { + TestGraphWithGeneric test = new TestGraphWithGeneric<>(); + + // test type extraction in mapEdges + DataSet >> outEdges = test.mapEdges(inputGraph); + Assert.assertEquals(true, (new TupleTypeInfo(Edge.class, BasicTypeInfo.LONG_TYPE_INFO, BasicTypeInfo.LONG_TYPE_INFO, + new TupleTypeInfo >(BasicTypeInfo.LONG_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO))) + .equals(outEdges.getType())); + } + + public static final class VertexMapper implements MapFunction , Tuple2 > { + + private final Tuple2 outTuple = new Tuple2<>(); + + @Override + public Tuple2 map(Vertex inputVertex) throws Exception { + outTuple.setField(inputVertex.getId(), 0); + outTuple.setField(inputVertex.getValue().intValue(), 0); --- End diff -- `map()` could even be empty here, since this is never executed. > The TypeExtractor is
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15683950#comment-15683950 ] ASF GitHub Bot commented on FLINK-5097: --- Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/2842#discussion_r88926534 --- Diff: flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java --- @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.test.operations; + +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.api.java.typeutils.TupleTypeInfo; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.test.TestGraphUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +public class TypeExtractorTest { + + private GraphinputGraph; + + + @Before + public void setUp() throws Exception { + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + DataSet > vertices = TestGraphUtils.getLongLongVertexData(env); + DataSet > edges = TestGraphUtils.getLongLongEdgeData(env); + inputGraph = Graph.fromDataSet(vertices, edges, env); + } + + public class TestGraphWithGeneric { --- End diff -- Not necessary. I tried to create a minimal example of the reported case. The mapping methods could also be called inside the test methods. > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15683938#comment-15683938 ] ASF GitHub Bot commented on FLINK-5097: --- Github user vasia commented on a diff in the pull request: https://github.com/apache/flink/pull/2842#discussion_r88925478 --- Diff: flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java --- @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.test.operations; + +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.api.java.typeutils.TupleTypeInfo; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.test.TestGraphUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +public class TypeExtractorTest { + + private GraphinputGraph; + + + @Before + public void setUp() throws Exception { + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); --- End diff -- I don't think it'd make a difference. There is no execution. > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15683914#comment-15683914 ] ASF GitHub Bot commented on FLINK-5097: --- Github user greghogan commented on a diff in the pull request: https://github.com/apache/flink/pull/2842#discussion_r88914659 --- Diff: flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java --- @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.test.operations; + +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.api.java.typeutils.TupleTypeInfo; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.test.TestGraphUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +public class TypeExtractorTest { + + private GraphinputGraph; + + + @Before + public void setUp() throws Exception { + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + DataSet > vertices = TestGraphUtils.getLongLongVertexData(env); + DataSet > edges = TestGraphUtils.getLongLongEdgeData(env); + inputGraph = Graph.fromDataSet(vertices, edges, env); + } + + public class TestGraphWithGeneric { + + public DataSet >> mapVertices(Graph input) { + return input.mapVertices(new VertexMapper()).getVertices(); + } + + public DataSet >> mapEdges(Graph input) { + return input.mapEdges(new EdgeMapper()).getEdges(); + } + } + + @Test + public void testMapVerticesType() throws Exception { + TestGraphWithGeneric test = new TestGraphWithGeneric<>(); + + // test type extraction in mapVertices + DataSet >> outVertices = test.mapVertices(inputGraph); + Assert.assertEquals(true, (new TupleTypeInfo(Vertex.class, BasicTypeInfo.LONG_TYPE_INFO, --- End diff -- `Assert.assertTrue`? > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15683916#comment-15683916 ] ASF GitHub Bot commented on FLINK-5097: --- Github user greghogan commented on a diff in the pull request: https://github.com/apache/flink/pull/2842#discussion_r88920404 --- Diff: flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java --- @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.test.operations; + +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.api.java.typeutils.TupleTypeInfo; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.test.TestGraphUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +public class TypeExtractorTest { + + private GraphinputGraph; + + + @Before + public void setUp() throws Exception { + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + DataSet > vertices = TestGraphUtils.getLongLongVertexData(env); + DataSet > edges = TestGraphUtils.getLongLongEdgeData(env); + inputGraph = Graph.fromDataSet(vertices, edges, env); + } + + public class TestGraphWithGeneric { + + public DataSet >> mapVertices(Graph input) { + return input.mapVertices(new VertexMapper()).getVertices(); + } + + public DataSet >> mapEdges(Graph input) { + return input.mapEdges(new EdgeMapper()).getEdges(); + } + } + + @Test + public void testMapVerticesType() throws Exception { + TestGraphWithGeneric test = new TestGraphWithGeneric<>(); + + // test type extraction in mapVertices + DataSet >> outVertices = test.mapVertices(inputGraph); + Assert.assertEquals(true, (new TupleTypeInfo(Vertex.class, BasicTypeInfo.LONG_TYPE_INFO, + new TupleTypeInfo >(BasicTypeInfo.LONG_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO))) + .equals(outVertices.getType())); + } + + @Test + public void testMapEdgesType() throws Exception { + TestGraphWithGeneric test = new TestGraphWithGeneric<>(); + + // test type extraction in mapEdges + DataSet >> outEdges = test.mapEdges(inputGraph); + Assert.assertEquals(true, (new TupleTypeInfo(Edge.class, BasicTypeInfo.LONG_TYPE_INFO, BasicTypeInfo.LONG_TYPE_INFO, + new TupleTypeInfo >(BasicTypeInfo.LONG_TYPE_INFO, BasicTypeInfo.INT_TYPE_INFO))) + .equals(outEdges.getType())); + } + + public static final class VertexMapper implements MapFunction , Tuple2 > { + + private final Tuple2 outTuple = new Tuple2<>(); + + @Override + public Tuple2 map(Vertex inputVertex) throws Exception { + outTuple.setField(inputVertex.getId(), 0); + outTuple.setField(inputVertex.getValue().intValue(), 0); --- End diff -- This and again below should set field 1? I'm not seeing how this is compiling since
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15683913#comment-15683913 ] ASF GitHub Bot commented on FLINK-5097: --- Github user greghogan commented on a diff in the pull request: https://github.com/apache/flink/pull/2842#discussion_r88919762 --- Diff: flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java --- @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.test.operations; + +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.api.java.typeutils.TupleTypeInfo; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.test.TestGraphUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +public class TypeExtractorTest { + + private GraphinputGraph; + + + @Before + public void setUp() throws Exception { + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); --- End diff -- Do we want a local or collections environment? > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15683912#comment-15683912 ] ASF GitHub Bot commented on FLINK-5097: --- Github user greghogan commented on a diff in the pull request: https://github.com/apache/flink/pull/2842#discussion_r88921327 --- Diff: flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java --- @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.test.operations; + +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.api.java.typeutils.TupleTypeInfo; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.test.TestGraphUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +public class TypeExtractorTest { + + private GraphinputGraph; + + + @Before + public void setUp() throws Exception { + ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + DataSet > vertices = TestGraphUtils.getLongLongVertexData(env); + DataSet > edges = TestGraphUtils.getLongLongEdgeData(env); + inputGraph = Graph.fromDataSet(vertices, edges, env); + } + + public class TestGraphWithGeneric { --- End diff -- This class is necessary? > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15683915#comment-15683915 ] ASF GitHub Bot commented on FLINK-5097: --- Github user greghogan commented on a diff in the pull request: https://github.com/apache/flink/pull/2842#discussion_r88919069 --- Diff: flink-libraries/flink-gelly/src/test/java/org/apache/flink/graph/test/operations/TypeExtractorTest.java --- @@ -0,0 +1,106 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.flink.graph.test.operations; + +import org.apache.flink.api.common.functions.MapFunction; +import org.apache.flink.api.common.typeinfo.BasicTypeInfo; +import org.apache.flink.api.java.DataSet; +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.api.java.tuple.Tuple2; +import org.apache.flink.api.java.typeutils.TupleTypeInfo; +import org.apache.flink.graph.Edge; +import org.apache.flink.graph.Graph; +import org.apache.flink.graph.Vertex; +import org.apache.flink.graph.test.TestGraphUtils; +import org.junit.Assert; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; + +public class TypeExtractorTest { + + private GraphinputGraph; + --- End diff -- Extra newline. > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (FLINK-5097) The TypeExtractor is missing input type information in some Graph methods
[ https://issues.apache.org/jira/browse/FLINK-5097?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15683517#comment-15683517 ] ASF GitHub Bot commented on FLINK-5097: --- GitHub user vasia opened a pull request: https://github.com/apache/flink/pull/2842 [FLINK-5097][gelly] Add is missing input type information to TypeExtr… I've managed to reproduce @otherwise777's error as reported in the mailing list and added a test case that failed before the change. @twalthr please take a look when you have some time, thanks! You can merge this pull request into a Git repository by running: $ git pull https://github.com/vasia/flink flink-5097 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/flink/pull/2842.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 #2842 commit ea098c767151b6ba91fe54669a921e6303cd8c4d Author: vasiaDate: 2016-11-19T14:35:43Z [FLINK-5097][gelly] Add is missing input type information to TypeExtractor > The TypeExtractor is missing input type information in some Graph methods > - > > Key: FLINK-5097 > URL: https://issues.apache.org/jira/browse/FLINK-5097 > Project: Flink > Issue Type: Bug > Components: Gelly >Reporter: Vasia Kalavri >Assignee: Vasia Kalavri > > The TypeExtractor is called without information about the input type in > {{mapVertices}} and {{mapEdges}} although this information can be easily > retrieved. -- This message was sent by Atlassian JIRA (v6.3.4#6332)