Github user andralungu commented on a diff in the pull request:
https://github.com/apache/flink/pull/847#discussion_r33355251
--- Diff:
flink-staging/flink-gelly/src/main/java/org/apache/flink/graph/example/GraphMetrics.java
---
@@ -150,20 +149,15 @@ private static boolean parseParameters(String[] args)
{
}
@SuppressWarnings("serial")
- private static DataSet<Edge<Long, NullValue>>
getEdgesDataSet(ExecutionEnvironment env) {
- if (fileOutput) {
- return env.readCsvFile(edgesInputPath)
-
.lineDelimiter("\n").fieldDelimiter("\t")
- .types(Long.class, Long.class).map(
- new
MapFunction<Tuple2<Long, Long>, Edge<Long, NullValue>>() {
-
- public
Edge<Long, NullValue> map(Tuple2<Long, Long> value) {
- return
new Edge<Long, NullValue>(value.f0, value.f1,
-
NullValue.getInstance());
- }
- });
- } else {
- return ExampleUtils.getRandomEdges(env, NUM_VERTICES);
+ private static Graph<Long, NullValue, NullValue>
getGraph(ExecutionEnvironment env) {
+ if(fileOutput) {
+ return Graph.fromCsvReader(edgesInputPath,
env).lineDelimiterEdges("\n").fieldDelimiterEdges("\t")
+
.types(Long.class);
+
+ }
+ else
+ {
+ return
Graph.fromDataSet(ExampleUtils.getRandomEdges(env, NUM_VERTICES), env);
--- End diff --
Yup... so I like how this looks better than how the previous rewritings
were made...
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---