本文整理汇总了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();
}
示例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);
}
示例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);
}