Search in sources :

Example 1 with ToNullValue

use of org.apache.flink.graph.asm.translate.translators.ToNullValue in project flink by apache.

the class SummarizationITCase method testWithVertexAndAbsentEdgeStringValues.

@Test
public void testWithVertexAndAbsentEdgeStringValues() throws Exception {
    ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    Graph<Long, String, NullValue> input = Graph.fromDataSet(SummarizationData.getVertices(env), SummarizationData.getEdges(env), env).run(new TranslateEdgeValues<>(new ToNullValue<>()));
    List<Vertex<Long, Summarization.VertexValue<String>>> summarizedVertices = new ArrayList<>();
    List<Edge<Long, EdgeValue<NullValue>>> summarizedEdges = new ArrayList<>();
    Graph<Long, Summarization.VertexValue<String>, EdgeValue<NullValue>> output = input.run(new Summarization<>());
    output.getVertices().output(new LocalCollectionOutputFormat<>(summarizedVertices));
    output.getEdges().output(new LocalCollectionOutputFormat<>(summarizedEdges));
    env.execute();
    validateVertices(SummarizationData.EXPECTED_VERTICES, summarizedVertices);
    validateEdges(SummarizationData.EXPECTED_EDGES_ABSENT_VALUES, summarizedEdges);
}
Also used : Vertex(org.apache.flink.graph.Vertex) ExecutionEnvironment(org.apache.flink.api.java.ExecutionEnvironment) ArrayList(java.util.ArrayList) ToNullValue(org.apache.flink.graph.asm.translate.translators.ToNullValue) NullValue(org.apache.flink.types.NullValue) ToNullValue(org.apache.flink.graph.asm.translate.translators.ToNullValue) EdgeValue(org.apache.flink.graph.library.Summarization.EdgeValue) Edge(org.apache.flink.graph.Edge) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)1 ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)1 Edge (org.apache.flink.graph.Edge)1 Vertex (org.apache.flink.graph.Vertex)1 ToNullValue (org.apache.flink.graph.asm.translate.translators.ToNullValue)1 EdgeValue (org.apache.flink.graph.library.Summarization.EdgeValue)1 NullValue (org.apache.flink.types.NullValue)1 Test (org.junit.Test)1