当前位置: 首页>>代码示例>>Java>>正文


Java DataSet.project方法代码示例

本文整理汇总了Java中org.apache.flink.api.java.DataSet.project方法的典型用法代码示例。如果您正苦于以下问题:Java DataSet.project方法的具体用法?Java DataSet.project怎么用?Java DataSet.project使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.flink.api.java.DataSet的用法示例。


在下文中一共展示了DataSet.project方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testProgram

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Override
protected void testProgram() throws Exception {
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	DataSet<Long> longs = env.generateSequence(0, 100000);

	DataSet<Tuple1<Long>> longT1 = longs.map(new TupleWrapper());
	DataSet<Tuple1<Long>> longT2 = longT1.project(0);
	DataSet<Tuple1<Long>> longT3 = longs.map(new TupleWrapper());

	longT2.join(longT3).where(0).equalTo(0).projectFirst(0)
			.join(longT1).where(0).equalTo(0).projectFirst(0)
			.writeAsText(resultPath);

	env.execute();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:JoinDeadlockITCase.java

示例2: testProgram

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Override
protected void testProgram() throws Exception {
	/*
	 * Projection with tuple fields indexes
	 */

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds = CollectionDataSets.get5TupleDataSet(env);
	DataSet<Tuple3<String, Long, Integer>> projDs = ds.
			project(3,4,2);
	List<Tuple3<String, Long, Integer>> result = projDs.collect();

	String expectedResult = "Hallo,1,0\n" +
			"Hallo Welt,2,1\n" +
			"Hallo Welt wie,1,2\n" +
			"Hallo Welt wie gehts?,2,3\n" +
			"ABC,2,4\n" +
			"BCD,3,5\n" +
			"CDE,2,6\n" +
			"DEF,1,7\n" +
			"EFG,1,8\n" +
			"FGH,2,9\n" +
			"GHI,1,10\n" +
			"HIJ,3,11\n" +
			"IJK,3,12\n" +
			"JKL,2,13\n" +
			"KLM,2,14\n";

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

示例3: testProgram

import org.apache.flink.api.java.DataSet; //导入方法依赖的package包/类
@Override
protected void testProgram() throws Exception {
	/*
	 * Projection with tuple fields indexes
	 */

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds = CollectionDataSets.get5TupleDataSet(env);
	DataSet<Tuple3<String, Long, Integer>> projDs = ds.
			project(3, 4, 2);
	List<Tuple3<String, Long, Integer>> result = projDs.collect();

	String expectedResult = "Hallo,1,0\n" +
			"Hallo Welt,2,1\n" +
			"Hallo Welt wie,1,2\n" +
			"Hallo Welt wie gehts?,2,3\n" +
			"ABC,2,4\n" +
			"BCD,3,5\n" +
			"CDE,2,6\n" +
			"DEF,1,7\n" +
			"EFG,1,8\n" +
			"FGH,2,9\n" +
			"GHI,1,10\n" +
			"HIJ,3,11\n" +
			"IJK,3,12\n" +
			"JKL,2,13\n" +
			"KLM,2,14\n";

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


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