[ https://issues.apache.org/jira/browse/FLINK-1587?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14348376#comment-14348376 ]
ASF GitHub Bot commented on FLINK-1587: --------------------------------------- Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/440#discussion_r25846323 --- Diff: flink-staging/flink-gelly/src/test/java/org/apache/flink/graph/test/DegreesWithExceptionITCase.java --- @@ -0,0 +1,124 @@ +/* + * 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; + +import org.apache.flink.api.java.ExecutionEnvironment; +import org.apache.flink.graph.Graph; +import org.junit.Assert; +import org.junit.Test; + +import java.util.NoSuchElementException; + +public class DegreesWithExceptionITCase { + + @Test + public void testOutDegreesInvalidEdgeSrcId() throws Exception { + /* + * Test outDegrees() with an edge having a srcId that does not exist in the vertex DataSet + */ + final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + + Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env), + TestGraphUtils.getLongLongEdgeInvalidSrcData(env), env); + + try { + graph.outDegrees().print(); + env.execute(); + } catch (Exception e) { + Assert.assertEquals("The edge src/trg id could not be found within the vertexIds", e.getCause().getMessage()); + Assert.assertTrue(e.getCause() instanceof NoSuchElementException); + } + } + + @Test + public void testInDegreesInvalidEdgeTrgId() throws Exception { + /* + * Test inDegrees() with an edge having a trgId that does not exist in the vertex DataSet + */ + final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); + + Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env), + TestGraphUtils.getLongLongEdgeInvalidTrgData(env), env); + + try { + graph.inDegrees().print(); + env.execute(); --- End diff -- same here > coGroup throws NoSuchElementException on iterator.next() > -------------------------------------------------------- > > Key: FLINK-1587 > URL: https://issues.apache.org/jira/browse/FLINK-1587 > Project: Flink > Issue Type: Bug > Components: Gelly > Environment: flink-0.8.0-SNAPSHOT > Reporter: Carsten Brandt > Assignee: Andra Lungu > > I am receiving the following exception when running a simple job that > extracts outdegree from a graph using Gelly. It is currently only failing on > the cluster and I am not able to reproduce it locally. Will try that the next > days. > {noformat} > 02/20/2015 02:27:02: CoGroup (CoGroup at inDegrees(Graph.java:675)) (5/64) > switched to FAILED > java.util.NoSuchElementException > at java.util.Collections$EmptyIterator.next(Collections.java:3006) > at flink.graphs.Graph$CountNeighborsCoGroup.coGroup(Graph.java:665) > at > org.apache.flink.runtime.operators.CoGroupDriver.run(CoGroupDriver.java:130) > at > org.apache.flink.runtime.operators.RegularPactTask.run(RegularPactTask.java:493) > at > org.apache.flink.runtime.operators.RegularPactTask.invoke(RegularPactTask.java:360) > at > org.apache.flink.runtime.execution.RuntimeEnvironment.run(RuntimeEnvironment.java:257) > at java.lang.Thread.run(Thread.java:745) > 02/20/2015 02:27:02: Job execution switched to status FAILING > ... > {noformat} > The error occurs in Gellys Graph.java at this line: > https://github.com/apache/flink/blob/a51c02f6e8be948d71a00c492808115d622379a7/flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/Graph.java#L636 > Is there any valid case where a coGroup Iterator may be empty? As far as I > see there is a bug somewhere. > I'd like to write a test case for this to reproduce the issue. Where can I > put such a test? -- This message was sent by Atlassian JIRA (v6.3.4#6332)