/** *Configures the Delimiter that separates rows for the CSV reader used to read the edges * ({@code '\n'}) is used by default. * *@param delimiter The delimiter that separates the rows. * @return The GraphCSVReader instance itself, to allow for fluent function chaining. */ public GraphCsvReader lineDelimiterEdges(String delimiter) { edgeReader.lineDelimiter(delimiter); return this; }
/** *Configures the Delimiter that separates rows for the CSV reader used to read the vertices * ({@code '\n'}) is used by default. * *@param delimiter The delimiter that separates the rows. * @return The GraphCSVReader instance itself, to allow for fluent function chaining. */ public GraphCsvReader lineDelimiterVertices(String delimiter) { if (this.vertexReader != null) { this.vertexReader.lineDelimiter(delimiter); } return this; }
private static DataSet<Tuple2<Long, Long>> getLinksDataSet(ExecutionEnvironment env, ParameterTool params) { if (params.has("links")) { return env.readCsvFile(params.get("links")) .fieldDelimiter(" ") .lineDelimiter("\n") .types(Long.class, Long.class); } else { System.out.println("Executing PageRank example with default links data set."); System.out.println("Use --links to specify file input."); return PageRankData.getDefaultEdgeDataSet(env); } } }
private static DataSet<Tuple3<String, String, Integer>> getUserSongTripletsData(ExecutionEnvironment env) { if (fileOutput) { return env.readCsvFile(userSongTripletsInputPath) .lineDelimiter("\n").fieldDelimiter("\t") .types(String.class, String.class, Integer.class); } else { return MusicProfilesData.getUserSongTriplets(env); } }
private static DataSet<Vertex<Long, Point>> getVerticesDataSet(ExecutionEnvironment env) { if (fileOutput) { return env.readCsvFile(verticesInputPath) .lineDelimiter("\n") .types(Long.class, Double.class, Double.class) .map(new MapFunction<Tuple3<Long, Double, Double>, Vertex<Long, Point>>() { @Override public Vertex<Long, Point> map(Tuple3<Long, Double, Double> value) throws Exception { return new Vertex<>(value.f0, new Point(value.f1, value.f2)); } }); } else { return EuclideanGraphData.getDefaultVertexDataSet(env); } }
private static DataSet<Edge<Long, Double>> getEdgesDataSet(ExecutionEnvironment env) { if (fileOutput) { return env.readCsvFile(edgesInputPath) .lineDelimiter("\n") .types(Long.class, Long.class) .map(new MapFunction<Tuple2<Long, Long>, Edge<Long, Double>>() { @Override public Edge<Long, Double> map(Tuple2<Long, Long> tuple2) throws Exception { return new Edge<>(tuple2.f0, tuple2.f1, 0.0); } }); } else { return EuclideanGraphData.getDefaultEdgeDataSet(env); } } }
private static DataSet<Long> getPagesDataSet(ExecutionEnvironment env, ParameterTool params) { if (params.has("pages")) { return env.readCsvFile(params.get("pages")) .fieldDelimiter(" ") .lineDelimiter("\n") .types(Long.class) .map(new MapFunction<Tuple1<Long>, Long>() { @Override public Long map(Tuple1<Long> v) { return v.f0; } }); } else { System.out.println("Executing PageRank example with default pages data set."); System.out.println("Use --pages to specify file input."); return PageRankData.getDefaultPagesDataSet(env); } }
private static DataSet<Edge<Long, Double>> getEdgesDataSet(ExecutionEnvironment env) { if (fileOutput) { return env.readCsvFile(edgesInputPath) .lineDelimiter("\n") .fieldDelimiter("\t") .types(Long.class, Long.class, Double.class) .map(new Tuple3ToEdgeMap<>()); } else { return SingleSourceShortestPathsData.getDefaultEdgeDataSet(env); } }
private static DataSet<Edge<Long, Double>> getEdgeDataSet(ExecutionEnvironment env) { if (fileOutput) { return env.readCsvFile(edgesInputPath) .fieldDelimiter("\t") .lineDelimiter("\n") .types(Long.class, Long.class, Double.class) .map(new Tuple3ToEdgeMap<>()); } else { return SingleSourceShortestPathsData.getDefaultEdgeDataSet(env); } }
private static DataSet<Edge<Long, Double>> getEdgesDataSet(ExecutionEnvironment env) { if (fileOutput) { return env.readCsvFile(edgesInputPath) .lineDelimiter("\n") .fieldDelimiter("\t") .ignoreComments("%") .types(Long.class, Long.class, Double.class) .map(new Tuple3ToEdgeMap<>()); } else { return SingleSourceShortestPathsData.getDefaultEdgeDataSet(env); } }
public static void tcph3(String[] args) throws Exception { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); env.setParallelism(Integer.parseInt(args[0])); //order id, order status, order data, order prio, ship prio DataSet<Tuple5<Long, String, String, String, Integer>> orders = env.readCsvFile(args[1]) .fieldDelimiter("|").lineDelimiter("\n") .includeFields("101011001").types(Long.class, String.class, String.class, String.class, Integer.class) .name(ORDERS); //order id, extended price DataSet<Tuple2<Long, Double>> lineItems = env.readCsvFile(args[2]) .fieldDelimiter("|").lineDelimiter("\n") .includeFields("100001").types(Long.class, Double.class) .name(LINEITEM); DataSet<Tuple2<Long, Integer>> filterO = orders.flatMap(new FilterO()).name(MAPPER_NAME); DataSet<Tuple3<Long, Integer, Double>> joinLiO = filterO.join(lineItems).where(0).equalTo(0).with(new JoinLiO()).name(JOIN_NAME); DataSet<Tuple3<Long, Integer, Double>> aggLiO = joinLiO.groupBy(0, 1).reduceGroup(new AggLiO()).name(REDUCE_NAME); aggLiO.writeAsCsv(args[3], "\n", "|").name(SINK); env.execute(); }
/** *Configures the Delimiter that separates rows for the CSV reader used to read the edges * ({@code '\n'}) is used by default. * *@param delimiter The delimiter that separates the rows. * @return The GraphCSVReader instance itself, to allow for fluent function chaining. */ public GraphCsvReader lineDelimiterEdges(String delimiter) { edgeReader.lineDelimiter(delimiter); return this; }
/** *Configures the Delimiter that separates rows for the CSV reader used to read the edges * ({@code '\n'}) is used by default. * *@param delimiter The delimiter that separates the rows. * @return The GraphCSVReader instance itself, to allow for fluent function chaining. */ public GraphCsvReader lineDelimiterEdges(String delimiter) { edgeReader.lineDelimiter(delimiter); return this; }
/** *Configures the Delimiter that separates rows for the CSV reader used to read the edges * ({@code '\n'}) is used by default. * *@param delimiter The delimiter that separates the rows. * @return The GraphCSVReader instance itself, to allow for fluent function chaining. */ public GraphCsvReader lineDelimiterEdges(String delimiter) { edgeReader.lineDelimiter(delimiter); return this; }
/** *Configures the Delimiter that separates rows for the CSV reader used to read the vertices * ({@code '\n'}) is used by default. * *@param delimiter The delimiter that separates the rows. * @return The GraphCSVReader instance itself, to allow for fluent function chaining. */ public GraphCsvReader lineDelimiterVertices(String delimiter) { if (this.vertexReader != null) { this.vertexReader.lineDelimiter(delimiter); } return this; }
/** *Configures the Delimiter that separates rows for the CSV reader used to read the vertices * ({@code '\n'}) is used by default. * *@param delimiter The delimiter that separates the rows. * @return The GraphCSVReader instance itself, to allow for fluent function chaining. */ public GraphCsvReader lineDelimiterVertices(String delimiter) { if(this.vertexReader != null) { this.vertexReader.lineDelimiter(delimiter); } return this; }
private static DataSet<Tuple2<Long, Long>> getLinksDataSet(ExecutionEnvironment env, ParameterTool params) { if (params.has("links")) { return env.readCsvFile(params.get("links")) .fieldDelimiter(" ") .lineDelimiter("\n") .types(Long.class, Long.class); } else { System.out.println("Executing PageRank example with default links data set."); System.out.println("Use --links to specify file input."); return PageRankData.getDefaultEdgeDataSet(env); } } }
private static DataSet<Tuple2<Long, Long>> getLinksDataSet(ExecutionEnvironment env, ParameterTool params) { if (params.has("links")) { return env.readCsvFile(params.get("links")) .fieldDelimiter(" ") .lineDelimiter("\n") .types(Long.class, Long.class); } else { System.out.println("Executing PageRank example with default links data set."); System.out.println("Use --links to specify file input."); return PageRankData.getDefaultEdgeDataSet(env); } } }
private static DataSet<Tuple2<Long, Long>> getLinksDataSet(ExecutionEnvironment env, ParameterTool params) { if (params.has("links")) { return env.readCsvFile(params.get("links")) .fieldDelimiter(" ") .lineDelimiter("\n") .types(Long.class, Long.class); } else { System.out.println("Executing PageRank example with default links data set."); System.out.println("Use --links to specify file input."); return PageRankData.getDefaultEdgeDataSet(env); } } }
private static DataSet<Tuple2<Long, Long>> getLinksDataSet(ExecutionEnvironment env) { if(fileOutput) { return env.readCsvFile(linksInputPath) .fieldDelimiter(" ") .lineDelimiter("\n") .types(Long.class, Long.class); } else { return PageRankData.getDefaultEdgeDataSet(env); } } }