use of org.apache.flink.graph.GraphCsvReader in project flink by apache.
the class CSV method create.
@Override
public Graph<K, NullValue, NullValue> create(ExecutionEnvironment env) throws Exception {
GraphCsvReader reader = Graph.fromCsvReader(inputFilename.getValue(), env).ignoreCommentsEdges(commentPrefix.getValue()).lineDelimiterEdges(lineDelimiter.getValue()).fieldDelimiterEdges(fieldDelimiter.getValue());
Graph<K, NullValue, NullValue> graph;
switch(type.getValue()) {
case INTEGER:
graph = (Graph<K, NullValue, NullValue>) reader.keyType(IntValue.class);
break;
case LONG:
graph = (Graph<K, NullValue, NullValue>) reader.keyType(LongValue.class);
break;
case STRING:
graph = (Graph<K, NullValue, NullValue>) reader.keyType(StringValue.class);
break;
default:
throw new ProgramParametrizationException("Unknown type '" + type.getValue() + "'");
}
return simplify.simplify(graph, parallelism.getValue().intValue());
}
Aggregations