use of org.apache.flink.api.java.tuple.Tuple6 in project flink by apache.
the class CrossITCase method testProjectCrossOnATupleInput1.
@Test
public void testProjectCrossOnATupleInput1() throws Exception {
/*
* project cross on a tuple input 1
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<Tuple3<Integer, Long, String>> ds = CollectionDataSets.getSmall3TupleDataSet(env);
DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds2 = CollectionDataSets.getSmall5TupleDataSet(env);
DataSet<Tuple6<String, Long, String, Integer, Long, Long>> crossDs = ds.cross(ds2).projectFirst(2, 1).projectSecond(3).projectFirst(0).projectSecond(4, 1);
List<Tuple6<String, Long, String, Integer, Long, Long>> result = crossDs.collect();
String expected = "Hi,1,Hallo,1,1,1\n" + "Hi,1,Hallo Welt,1,2,2\n" + "Hi,1,Hallo Welt wie,1,1,3\n" + "Hello,2,Hallo,2,1,1\n" + "Hello,2,Hallo Welt,2,2,2\n" + "Hello,2,Hallo Welt wie,2,1,3\n" + "Hello world,2,Hallo,3,1,1\n" + "Hello world,2,Hallo Welt,3,2,2\n" + "Hello world,2,Hallo Welt wie,3,1,3\n";
compareResultAsTuples(result, expected);
}
Aggregations