[
https://issues.apache.org/jira/browse/FLINK-1522?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14324429#comment-14324429
]
ASF GitHub Bot commented on FLINK-1522:
---------------------------------------
Github user rmetzger commented on a diff in the pull request:
https://github.com/apache/flink/pull/414#discussion_r24829996
--- Diff:
flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/SingleSourceShortestPathsExample.java
---
@@ -56,4 +63,77 @@ public static void main(String[] args) throws Exception {
public String getDescription() {
return "Single Source Shortest Paths";
}
+
+ //
******************************************************************************************************************
+ // UTIL METHODS
+ //
******************************************************************************************************************
+
+ private static boolean fileOutput = false;
+
+ private static Long srcVertexId = null;
+
+ private static String verticesInputPath = null;
+
+ private static String edgesInputPath = null;
+
+ private static String outputPath = null;
+
+ private static int maxIterations = 5;
+
+ private static boolean parseParameters(String[] args) {
+
+ if (args.length > 0) {
+ if (args.length == 5) {
+ fileOutput = true;
+ srcVertexId = Long.parseLong(args[0]);
+ verticesInputPath = args[1];
+ edgesInputPath = args[2];
+ outputPath = args[3];
+ maxIterations = Integer.parseInt(args[4]);
+ } else {
+ System.err.println("Usage:
SingleSourceShortestPaths <source vertex id>" +
+ " <input vertices path> <input
edges path> <output path> <num iterations>");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private static DataSet<Vertex<Long, Double>>
getVerticesDataSet(ExecutionEnvironment env) {
+ if (fileOutput) {
+ return env.readCsvFile(verticesInputPath)
+ .lineDelimiter("\n")
+ .types(Long.class, Double.class)
+ .map(new MapFunction<Tuple2<Long,
Double>, Vertex<Long, Double>>() {
+
+ @Override
+ public Vertex<Long, Double>
map(Tuple2<Long, Double> tuple2) throws Exception {
+ return new Vertex<Long,
Double>(tuple2.f0, tuple2.f1);
+ }
+ });
+ } else {
+ System.err.println("Usage: SingleSourceShortestPaths
<source vertex id>" +
+ " <input vertices path> <input edges
path> <output path> <num iterations>");
+ return null;
--- End diff --
I suspect the code will fail with a null pointer exception?
> Add tests for the library methods and examples
> ----------------------------------------------
>
> Key: FLINK-1522
> URL: https://issues.apache.org/jira/browse/FLINK-1522
> Project: Flink
> Issue Type: New Feature
> Components: Gelly
> Reporter: Vasia Kalavri
> Assignee: Daniel Bali
> Labels: easyfix, test
>
> The current tests in gelly test one method at a time. We should have some
> tests for complete applications. As a start, we could add one test case per
> example and this way also make sure that our graph library methods actually
> give correct results.
> I'm assigning this to [~andralungu] because she has already implemented the
> test for SSSP, but I will help as well.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)