org.apache.flink.graph.test.TestGraphUtils.DummyCustomParameterizedType Java Examples
The following examples show how to use
org.apache.flink.graph.test.TestGraphUtils.DummyCustomParameterizedType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MapVerticesITCase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testWithCustomParametrizedType() throws Exception { /* * Test mapVertices() and change the value type to a parameterized custom type */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env), TestGraphUtils.getLongLongEdgeData(env), env); DataSet<Vertex<Long, DummyCustomParameterizedType<Double>>> mappedVertices = graph.mapVertices( new ToCustomParametrizedTypeMapper()).getVertices(); List<Vertex<Long, DummyCustomParameterizedType<Double>>> result = mappedVertices.collect(); expectedResult = "1,(1.0,1)\n" + "2,(2.0,2)\n" + "3,(3.0,3)\n" + "4,(4.0,4)\n" + "5,(5.0,5)\n"; compareResultAsTuples(result, expectedResult); }
Example #2
Source File: GraphCreationITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testCreateWithCustomVertexValue() throws Exception { /* * Test create() with edge dataset and a mapper that assigns a parametrized custom vertex value */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, DummyCustomParameterizedType<Double>, Long> graph = Graph.fromDataSet( TestGraphUtils.getLongLongEdgeData(env), new AssignCustomVertexValueMapper(), env); DataSet<Vertex<Long, DummyCustomParameterizedType<Double>>> data = graph.getVertices(); List<Vertex<Long, DummyCustomParameterizedType<Double>>> result = data.collect(); expectedResult = "1,(2.0,0)\n" + "2,(4.0,1)\n" + "3,(6.0,2)\n" + "4,(8.0,3)\n" + "5,(10.0,4)\n"; compareResultAsTuples(result, expectedResult); }
Example #3
Source File: GraphCreationITCase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testCreateWithCustomVertexValue() throws Exception { /* * Test create() with edge dataset and a mapper that assigns a parametrized custom vertex value */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, DummyCustomParameterizedType<Double>, Long> graph = Graph.fromDataSet( TestGraphUtils.getLongLongEdgeData(env), new AssignCustomVertexValueMapper(), env); DataSet<Vertex<Long, DummyCustomParameterizedType<Double>>> data = graph.getVertices(); List<Vertex<Long, DummyCustomParameterizedType<Double>>> result = data.collect(); expectedResult = "1,(2.0,0)\n" + "2,(4.0,1)\n" + "3,(6.0,2)\n" + "4,(8.0,3)\n" + "5,(10.0,4)\n"; compareResultAsTuples(result, expectedResult); }
Example #4
Source File: MapVerticesITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testWithCustomParametrizedType() throws Exception { /* * Test mapVertices() and change the value type to a parameterized custom type */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env), TestGraphUtils.getLongLongEdgeData(env), env); DataSet<Vertex<Long, DummyCustomParameterizedType<Double>>> mappedVertices = graph.mapVertices( new ToCustomParametrizedTypeMapper()).getVertices(); List<Vertex<Long, DummyCustomParameterizedType<Double>>> result = mappedVertices.collect(); expectedResult = "1,(1.0,1)\n" + "2,(2.0,2)\n" + "3,(3.0,3)\n" + "4,(4.0,4)\n" + "5,(5.0,5)\n"; compareResultAsTuples(result, expectedResult); }
Example #5
Source File: MapEdgesITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testWithParametrizedCustomType() throws Exception { /* * Test mapEdges() and change the value type to a parameterized custom type */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env), TestGraphUtils.getLongLongEdgeData(env), env); DataSet<Edge<Long, DummyCustomParameterizedType<Double>>> mappedEdges = graph.mapEdges( new ToCustomParametrizedTypeMapper()).getEdges(); List<Edge<Long, DummyCustomParameterizedType<Double>>> result = mappedEdges.collect(); expectedResult = "1,2,(12.0,12)\n" + "1,3,(13.0,13)\n" + "2,3,(23.0,23)\n" + "3,4,(34.0,34)\n" + "3,5,(35.0,35)\n" + "4,5,(45.0,45)\n" + "5,1,(51.0,51)\n"; compareResultAsTuples(result, expectedResult); }
Example #6
Source File: MapVerticesITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testWithCustomParametrizedType() throws Exception { /* * Test mapVertices() and change the value type to a parameterized custom type */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env), TestGraphUtils.getLongLongEdgeData(env), env); DataSet<Vertex<Long, DummyCustomParameterizedType<Double>>> mappedVertices = graph.mapVertices( new ToCustomParametrizedTypeMapper()).getVertices(); List<Vertex<Long, DummyCustomParameterizedType<Double>>> result = mappedVertices.collect(); expectedResult = "1,(1.0,1)\n" + "2,(2.0,2)\n" + "3,(3.0,3)\n" + "4,(4.0,4)\n" + "5,(5.0,5)\n"; compareResultAsTuples(result, expectedResult); }
Example #7
Source File: MapEdgesITCase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testWithParametrizedCustomType() throws Exception { /* * Test mapEdges() and change the value type to a parameterized custom type */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env), TestGraphUtils.getLongLongEdgeData(env), env); DataSet<Edge<Long, DummyCustomParameterizedType<Double>>> mappedEdges = graph.mapEdges( new ToCustomParametrizedTypeMapper()).getEdges(); List<Edge<Long, DummyCustomParameterizedType<Double>>> result = mappedEdges.collect(); expectedResult = "1,2,(12.0,12)\n" + "1,3,(13.0,13)\n" + "2,3,(23.0,23)\n" + "3,4,(34.0,34)\n" + "3,5,(35.0,35)\n" + "4,5,(45.0,45)\n" + "5,1,(51.0,51)\n"; compareResultAsTuples(result, expectedResult); }
Example #8
Source File: GraphCreationITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testCreateWithCustomVertexValue() throws Exception { /* * Test create() with edge dataset and a mapper that assigns a parametrized custom vertex value */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, DummyCustomParameterizedType<Double>, Long> graph = Graph.fromDataSet( TestGraphUtils.getLongLongEdgeData(env), new AssignCustomVertexValueMapper(), env); DataSet<Vertex<Long, DummyCustomParameterizedType<Double>>> data = graph.getVertices(); List<Vertex<Long, DummyCustomParameterizedType<Double>>> result = data.collect(); expectedResult = "1,(2.0,0)\n" + "2,(4.0,1)\n" + "3,(6.0,2)\n" + "4,(8.0,3)\n" + "5,(10.0,4)\n"; compareResultAsTuples(result, expectedResult); }
Example #9
Source File: MapEdgesITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testWithParametrizedCustomType() throws Exception { /* * Test mapEdges() and change the value type to a parameterized custom type */ final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, Long, Long> graph = Graph.fromDataSet(TestGraphUtils.getLongLongVertexData(env), TestGraphUtils.getLongLongEdgeData(env), env); DataSet<Edge<Long, DummyCustomParameterizedType<Double>>> mappedEdges = graph.mapEdges( new ToCustomParametrizedTypeMapper()).getEdges(); List<Edge<Long, DummyCustomParameterizedType<Double>>> result = mappedEdges.collect(); expectedResult = "1,2,(12.0,12)\n" + "1,3,(13.0,13)\n" + "2,3,(23.0,23)\n" + "3,4,(34.0,34)\n" + "3,5,(35.0,35)\n" + "4,5,(45.0,45)\n" + "5,1,(51.0,51)\n"; compareResultAsTuples(result, expectedResult); }
Example #10
Source File: MapVerticesITCase.java From flink with Apache License 2.0 | 4 votes |
public DummyCustomParameterizedType<Double> map(Vertex<Long, Long> vertex) throws Exception { DummyCustomParameterizedType<Double> dummyValue = new DummyCustomParameterizedType<>(); dummyValue.setIntField(vertex.getValue().intValue()); dummyValue.setTField(new Double(vertex.getValue())); return dummyValue; }
Example #11
Source File: JoinWithVerticesITCase.java From flink with Apache License 2.0 | 4 votes |
public Long vertexJoin(Long vertexValue, DummyCustomParameterizedType<Float> inputValue) { return (long) inputValue.getIntField(); }
Example #12
Source File: GraphCreationITCase.java From flink with Apache License 2.0 | 4 votes |
public DummyCustomParameterizedType<Double> map(Long vertexId) { dummyValue.setIntField(vertexId.intValue() - 1); dummyValue.setTField(vertexId * 2.0); return dummyValue; }
Example #13
Source File: MapVerticesITCase.java From flink with Apache License 2.0 | 4 votes |
public DummyCustomParameterizedType<Double> map(Vertex<Long, Long> vertex) throws Exception { DummyCustomParameterizedType<Double> dummyValue = new DummyCustomParameterizedType<>(); dummyValue.setIntField(vertex.getValue().intValue()); dummyValue.setTField(new Double(vertex.getValue())); return dummyValue; }
Example #14
Source File: JoinWithEdgesITCase.java From flink with Apache License 2.0 | 4 votes |
public Long edgeJoin(Long edgeValue, DummyCustomParameterizedType<Float> inputValue) { return (long) inputValue.getIntField(); }
Example #15
Source File: MapEdgesITCase.java From flink with Apache License 2.0 | 4 votes |
public DummyCustomParameterizedType<Double> map(Edge<Long, Long> edge) throws Exception { DummyCustomParameterizedType<Double> dummyValue = new DummyCustomParameterizedType<>(); dummyValue.setIntField(edge.getValue().intValue()); dummyValue.setTField(new Double(edge.getValue())); return dummyValue; }
Example #16
Source File: JoinWithVerticesITCase.java From flink with Apache License 2.0 | 4 votes |
public Long vertexJoin(Long vertexValue, DummyCustomParameterizedType<Float> inputValue) { return (long) inputValue.getIntField(); }
Example #17
Source File: GraphCreationITCase.java From flink with Apache License 2.0 | 4 votes |
public DummyCustomParameterizedType<Double> map(Long vertexId) { dummyValue.setIntField(vertexId.intValue() - 1); dummyValue.setTField(vertexId * 2.0); return dummyValue; }
Example #18
Source File: JoinWithEdgesITCase.java From flink with Apache License 2.0 | 4 votes |
public Long edgeJoin(Long edgeValue, DummyCustomParameterizedType<Float> inputValue) { return (long) inputValue.getIntField(); }
Example #19
Source File: MapEdgesITCase.java From flink with Apache License 2.0 | 4 votes |
public DummyCustomParameterizedType<Double> map(Edge<Long, Long> edge) throws Exception { DummyCustomParameterizedType<Double> dummyValue = new DummyCustomParameterizedType<>(); dummyValue.setIntField(edge.getValue().intValue()); dummyValue.setTField(new Double(edge.getValue())); return dummyValue; }
Example #20
Source File: JoinWithVerticesITCase.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public Long vertexJoin(Long vertexValue, DummyCustomParameterizedType<Float> inputValue) { return (long) inputValue.getIntField(); }
Example #21
Source File: GraphCreationITCase.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public DummyCustomParameterizedType<Double> map(Long vertexId) { dummyValue.setIntField(vertexId.intValue() - 1); dummyValue.setTField(vertexId * 2.0); return dummyValue; }
Example #22
Source File: MapVerticesITCase.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public DummyCustomParameterizedType<Double> map(Vertex<Long, Long> vertex) throws Exception { DummyCustomParameterizedType<Double> dummyValue = new DummyCustomParameterizedType<>(); dummyValue.setIntField(vertex.getValue().intValue()); dummyValue.setTField(new Double(vertex.getValue())); return dummyValue; }
Example #23
Source File: JoinWithEdgesITCase.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public Long edgeJoin(Long edgeValue, DummyCustomParameterizedType<Float> inputValue) { return (long) inputValue.getIntField(); }
Example #24
Source File: MapEdgesITCase.java From Flink-CEPplus with Apache License 2.0 | 4 votes |
public DummyCustomParameterizedType<Double> map(Edge<Long, Long> edge) throws Exception { DummyCustomParameterizedType<Double> dummyValue = new DummyCustomParameterizedType<>(); dummyValue.setIntField(edge.getValue().intValue()); dummyValue.setTField(new Double(edge.getValue())); return dummyValue; }