• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java NullValue类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.flink.types.NullValue的典型用法代码示例。如果您正苦于以下问题:Java NullValue类的具体用法?Java NullValue怎么用?Java NullValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



NullValue类属于org.apache.flink.types包,在下文中一共展示了NullValue类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testFromTuple2WithMapper

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testFromTuple2WithMapper() throws Exception {
	/*
	 * Test graph creation with fromTuple2DataSet with vertex initializer
	 */
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple2<Long, Long>> edges = TestGraphUtils.getLongLongTuple2Data(env);

	Graph<Long, String, NullValue> graph = Graph.fromTuple2DataSet(edges,
		new BooMapper(), env);

	List<Vertex<Long, String>> result = graph.getVertices().collect();

	expectedResult = "1,boo\n" +
		"2,boo\n" +
		"3,boo\n" +
		"4,boo\n" +
		"6,boo\n" +
		"10,boo\n" +
		"20,boo\n" +
		"30,boo\n" +
		"40,boo\n" +
		"60,boo\n";

	compareResultAsTuples(result, expectedResult);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:27,代码来源:GraphCreationITCase.java


示例2: testFromTuple2

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testFromTuple2() throws Exception {
	/*
	 * Test graph creation with fromTuple2DataSet
	 */
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple2<Long, Long>> edges = TestGraphUtils.getLongLongTuple2Data(env);

	Graph<Long, NullValue, NullValue> graph = Graph.fromTuple2DataSet(edges, env);

	List<Vertex<Long, NullValue>> result = graph.getVertices().collect();

	expectedResult = "1,(null)\n" +
		"2,(null)\n" +
		"3,(null)\n" +
		"4,(null)\n" +
		"6,(null)\n" +
		"10,(null)\n" +
		"20,(null)\n" +
		"30,(null)\n" +
		"40,(null)\n" +
		"60,(null)\n";

	compareResultAsTuples(result, expectedResult);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:GraphCreationITCase.java


示例3: testWithSimpleGraph

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testWithSimpleGraph()
		throws Exception {
	DataSet<Result<IntValue>> hits = new HITS<IntValue, NullValue, NullValue>(20)
		.run(directedSimpleGraph);

	List<Tuple2<Double, Double>> expectedResults = new ArrayList<>();
	expectedResults.add(Tuple2.of(0.544643396306, 0.0));
	expectedResults.add(Tuple2.of(0.0, 0.836329395866));
	expectedResults.add(Tuple2.of(0.607227031134, 0.268492526138));
	expectedResults.add(Tuple2.of(0.544643396306, 0.395444899355));
	expectedResults.add(Tuple2.of(0.0, 0.268492526138));
	expectedResults.add(Tuple2.of(0.194942233447, 0.0));

	for (Result<IntValue> result : hits.collect()) {
		int id = result.f0.getValue();
		assertEquals(expectedResults.get(id).f0, result.getHubScore().getValue(), 0.000001);
		assertEquals(expectedResults.get(id).f1, result.getAuthorityScore().getValue(), 0.000001);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:HITSTest.java


示例4: testWithSimpleGraph

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testWithSimpleGraph()
		throws Exception {
	DataSet<Result<IntValue>> pr = new PageRank<IntValue, NullValue, NullValue>(DAMPING_FACTOR, 10)
		.run(directedSimpleGraph);

	List<Double> expectedResults = new ArrayList<>();
	expectedResults.add(0.09091296131286301);
	expectedResults.add(0.27951855944178117);
	expectedResults.add(0.12956847924535586);
	expectedResults.add(0.22329643739217675);
	expectedResults.add(0.18579060129496028);
	expectedResults.add(0.09091296131286301);

	for (Tuple2<IntValue, DoubleValue> result : pr.collect()) {
		int id = result.f0.getValue();
		assertEquals(expectedResults.get(id), result.f1.getValue(), 0.000001);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:20,代码来源:PageRankTest.java


示例5: testWithSimpleGraph

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testWithSimpleGraph() throws Exception {
	String expectedResult =
		"(0,2)\n" +
		"(1,3)\n" +
		"(2,3)\n" +
		"(3,4)\n" +
		"(4,1)\n" +
		"(5,1)";

	DataSet<Vertex<IntValue, LongValue>> degreeOnSourceId = undirectedSimpleGraph
		.run(new VertexDegree<IntValue, NullValue, NullValue>()
			.setReduceOnTargetId(false));

	TestBaseUtils.compareResultAsText(degreeOnSourceId.collect(), expectedResult);

	DataSet<Vertex<IntValue, LongValue>> degreeOnTargetId = undirectedSimpleGraph
		.run(new VertexDegree<IntValue, NullValue, NullValue>()
			.setReduceOnTargetId(true));

	TestBaseUtils.compareResultAsText(degreeOnTargetId.collect(), expectedResult);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:VertexDegreeTest.java


示例6: testWithCompleteGraph

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testWithCompleteGraph()
		throws Exception {
	double expectedScore = 1.0 / Math.sqrt(completeGraphVertexCount);

	DataSet<Result<LongValue>> hits = new HITS<LongValue, NullValue, NullValue>(0.000001)
		.run(completeGraph);

	List<Result<LongValue>> results = hits.collect();

	assertEquals(completeGraphVertexCount, results.size());

	for (Result<LongValue> result : results) {
		assertEquals(expectedScore, result.getHubScore().getValue(), 0.000001);
		assertEquals(expectedScore, result.getAuthorityScore().getValue(), 0.000001);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:HITSTest.java


示例7: testGraphMetrics

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testGraphMetrics() throws Exception {
	int vertexCount = 10;

	Graph<LongValue, NullValue, NullValue> graph = new CompleteGraph(env, vertexCount)
		.generate();

	assertEquals(vertexCount, graph.numberOfVertices());
	assertEquals(vertexCount * (vertexCount - 1), graph.numberOfEdges());

	long minInDegree = graph.inDegrees().min(1).collect().get(0).f1.getValue();
	long minOutDegree = graph.outDegrees().min(1).collect().get(0).f1.getValue();
	long maxInDegree = graph.inDegrees().max(1).collect().get(0).f1.getValue();
	long maxOutDegree = graph.outDegrees().max(1).collect().get(0).f1.getValue();

	assertEquals(vertexCount - 1, minInDegree);
	assertEquals(vertexCount - 1, minOutDegree);
	assertEquals(vertexCount - 1, maxInDegree);
	assertEquals(vertexCount - 1, maxOutDegree);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:CompleteGraphTest.java


示例8: testWithEmptyGraphWithVertices

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testWithEmptyGraphWithVertices() throws Exception {
	DataSet<Vertex<LongValue, LongValue>> outDegreeWithoutZeroDegreeVertices = emptyGraphWithVertices
		.run(new VertexOutDegree<LongValue, NullValue, NullValue>()
			.setIncludeZeroDegreeVertices(false));

	assertEquals(0, outDegreeWithoutZeroDegreeVertices.collect().size());

	DataSet<Vertex<LongValue, LongValue>> outDegreeWithZeroDegreeVertices = emptyGraphWithVertices
		.run(new VertexOutDegree<LongValue, NullValue, NullValue>()
			.setIncludeZeroDegreeVertices(true));

	String expectedResult =
		"(0,0)\n" +
		"(1,0)\n" +
		"(2,0)";

	TestBaseUtils.compareResultAsText(outDegreeWithZeroDegreeVertices.collect(), expectedResult);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:20,代码来源:VertexOutDegreeTest.java


示例9: testWithDirectedSimpleGraph

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testWithDirectedSimpleGraph() throws Exception {
	DataSet<Vertex<IntValue, LongValue>> inDegree = directedSimpleGraph
		.run(new VertexInDegree<IntValue, NullValue, NullValue>()
			.setIncludeZeroDegreeVertices(true));

	String expectedResult =
		"(0,0)\n" +
		"(1,3)\n" +
		"(2,1)\n" +
		"(3,2)\n" +
		"(4,1)\n" +
		"(5,0)";

	TestBaseUtils.compareResultAsText(inDegree.collect(), expectedResult);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:VertexInDegreeTest.java


示例10: testGraphMetrics

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testGraphMetrics() throws Exception {
	int vertexCount = 100;

	Graph<LongValue, NullValue, NullValue> graph = new PathGraph(env, vertexCount)
		.generate();

	assertEquals(vertexCount, graph.numberOfVertices());
	assertEquals(2 * (vertexCount - 1), graph.numberOfEdges());

	long minInDegree = graph.inDegrees().min(1).collect().get(0).f1.getValue();
	long minOutDegree = graph.outDegrees().min(1).collect().get(0).f1.getValue();
	long maxInDegree = graph.inDegrees().max(1).collect().get(0).f1.getValue();
	long maxOutDegree = graph.outDegrees().max(1).collect().get(0).f1.getValue();

	assertEquals(1, minInDegree);
	assertEquals(1, minOutDegree);
	assertEquals(2, maxInDegree);
	assertEquals(2, maxOutDegree);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:PathGraphTest.java


示例11: testWithSimpleGraph

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testWithSimpleGraph() throws Exception {
	DataSet<Result<IntValue>> hits = new HITS<IntValue, NullValue, NullValue>(20)
		.run(directedSimpleGraph);

	List<Tuple2<Double, Double>> expectedResults = new ArrayList<>();
	expectedResults.add(Tuple2.of(0.54464336064, 0.0));
	expectedResults.add(Tuple2.of(0.0, 0.836329364957));
	expectedResults.add(Tuple2.of(0.607227075863, 0.268492484699));
	expectedResults.add(Tuple2.of(0.54464336064, 0.395445020996));
	expectedResults.add(Tuple2.of(0.0, 0.268492484699));
	expectedResults.add(Tuple2.of(0.194942293412, 0.0));

	for (Result<IntValue> result : hits.collect()) {
		int id = result.getVertexId0().getValue();
		assertEquals(expectedResults.get(id).f0, result.getHubScore().getValue(), ACCURACY);
		assertEquals(expectedResults.get(id).f1, result.getAuthorityScore().getValue(), ACCURACY);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:20,代码来源:HITSTest.java


示例12: testTriangleEnumerator

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testTriangleEnumerator() throws Exception	{

	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	Graph<Long, NullValue, NullValue> graph = Graph.fromDataSet(TriangleCountData.getDefaultEdgeDataSet(env),
			env);

	List<Tuple3<Long, Long, Long>> actualOutput = graph.run(new TriangleEnumerator<>()).collect();
	List<Tuple3<Long, Long, Long>> expectedResult = TriangleCountData.getListOfTriangles();

	Assert.assertEquals(expectedResult.size(), actualOutput.size());
	for (Tuple3<Long, Long, Long> resultTriangle:actualOutput)	{
		Assert.assertTrue(expectedResult.indexOf(resultTriangle) >= 0);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:TriangleEnumeratorITCase.java


示例13: testWithSimpleGraph

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testWithSimpleGraph() throws Exception {
	Graph<IntValue, NullValue, NullValue> graph = undirectedSimpleGraph
		.run(new MaximumDegree<>(3));

	String expectedVerticesResult =
		"(0,(null))\n" +
		"(1,(null))\n" +
		"(2,(null))\n" +
		"(4,(null))\n" +
		"(5,(null))";

	TestBaseUtils.compareResultAsText(graph.getVertices().collect(), expectedVerticesResult);

	String expectedEdgesResult =
		"(0,1,(null))\n" +
		"(0,2,(null))\n" +
		"(1,0,(null))\n" +
		"(1,2,(null))\n" +
		"(2,0,(null))\n" +
		"(2,1,(null))";

	TestBaseUtils.compareResultAsText(graph.getEdges().collect(), expectedEdgesResult);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:MaximumDegreeTest.java


示例14: testGraphMetrics

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testGraphMetrics() throws Exception {
	int vertexCount = 100;

	Graph<LongValue, NullValue, NullValue> graph = new CycleGraph(env, vertexCount)
		.generate();

	assertEquals(vertexCount, graph.numberOfVertices());
	assertEquals(2 * vertexCount, graph.numberOfEdges());

	long minInDegree = graph.inDegrees().min(1).collect().get(0).f1.getValue();
	long minOutDegree = graph.outDegrees().min(1).collect().get(0).f1.getValue();
	long maxInDegree = graph.inDegrees().max(1).collect().get(0).f1.getValue();
	long maxOutDegree = graph.outDegrees().max(1).collect().get(0).f1.getValue();

	assertEquals(2, minInDegree);
	assertEquals(2, minOutDegree);
	assertEquals(2, maxInDegree);
	assertEquals(2, maxOutDegree);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:CycleGraphTest.java


示例15: generate

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Override
public Graph<LongValue, NullValue, NullValue> generate() {
	Preconditions.checkState(vertexCount >= 2);

	// Vertices
	DataSet<Vertex<LongValue, NullValue>> vertices = GraphGeneratorUtils.vertexSequence(env, parallelism, vertexCount);

	// Edges
	LongValueSequenceIterator iterator = new LongValueSequenceIterator(1, this.vertexCount - 1);

	DataSet<Edge<LongValue, NullValue>> edges = env
		.fromParallelCollection(iterator, LongValue.class)
			.setParallelism(parallelism)
			.name("Edge iterators")
		.flatMap(new LinkVertexToCenter())
			.setParallelism(parallelism)
			.name("Star graph edges");

	// Graph
	return Graph.fromDataSet(vertices, edges, env);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:StarGraph.java


示例16: testGetDegreesWithDisconnectedData

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testGetDegreesWithDisconnectedData() throws Exception {
	/*
	 * Test getDegrees() with disconnected data
	 */
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	Graph<Long, NullValue, Long> graph =
		Graph.fromDataSet(TestGraphUtils.getDisconnectedLongLongEdgeData(env), env);

	DataSet<Tuple2<Long, LongValue>> data = graph.outDegrees();
	List<Tuple2<Long, LongValue>> result = data.collect();

	expectedResult = "1,2\n" +
		"2,1\n" +
		"3,0\n" +
		"4,1\n" +
		"5,0\n";

	compareResultAsTuples(result, expectedResult);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:DegreesITCase.java


示例17: testGraphMetrics

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testGraphMetrics() throws Exception {
	int vertexCount = 100;

	Graph<LongValue, NullValue, NullValue> graph = new StarGraph(env, vertexCount)
		.generate();

	assertEquals(vertexCount, graph.numberOfVertices());
	assertEquals(2 * (vertexCount - 1), graph.numberOfEdges());

	long minInDegree = graph.inDegrees().min(1).collect().get(0).f1.getValue();
	long minOutDegree = graph.outDegrees().min(1).collect().get(0).f1.getValue();
	long maxInDegree = graph.inDegrees().max(1).collect().get(0).f1.getValue();
	long maxOutDegree = graph.outDegrees().max(1).collect().get(0).f1.getValue();

	assertEquals(1, minInDegree);
	assertEquals(1, minOutDegree);
	assertEquals(vertexCount - 1, maxInDegree);
	assertEquals(vertexCount - 1, maxOutDegree);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:StarGraphTest.java


示例18: testParallelism

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testParallelism() throws Exception {
	int parallelism = 2;

	Graph<LongValue, NullValue, NullValue> graph = new CompleteGraph(env, 10)
		.setParallelism(parallelism)
		.generate();

	graph.getVertices().output(new DiscardingOutputFormat<>());
	graph.getEdges().output(new DiscardingOutputFormat<>());

	TestUtils.verifyParallelism(env, parallelism);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:14,代码来源:CompleteGraphTest.java


示例19: testWithEmptyGraphWithoutVertices

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testWithEmptyGraphWithoutVertices() throws Exception {
	DataSet<Edge<LongValue, Tuple3<NullValue, Degrees, Degrees>>> degreesPair = emptyGraphWithoutVertices
		.run(new EdgeDegreesPair<>());

	assertEquals(0, degreesPair.collect().size());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:EdgeDegreesPairTest.java


示例20: testGraphMetrics

import org.apache.flink.types.NullValue; //导入依赖的package包/类
@Test
public void testGraphMetrics() throws Exception {
	long vertexCount = 100;

	long edgeCount = 1000;

	RandomGenerableFactory<JDKRandomGenerator> rnd = new JDKRandomGeneratorFactory();

	Graph<LongValue, NullValue, NullValue> graph = new RMatGraph<>(env, rnd, vertexCount, edgeCount)
		.generate();

	assertTrue(vertexCount >= graph.numberOfVertices());
	assertEquals(edgeCount, graph.numberOfEdges());
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:15,代码来源:RMatGraphTest.java



注:本文中的org.apache.flink.types.NullValue类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TearDownAccepter类代码示例发布时间:2022-05-23
下一篇:
Java VisitorAction类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap