本文整理汇总了Java中org.apache.flink.api.java.tuple.Tuple7类的典型用法代码示例。如果您正苦于以下问题:Java Tuple7类的具体用法?Java Tuple7怎么用?Java Tuple7使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tuple7类属于org.apache.flink.api.java.tuple包,在下文中一共展示了Tuple7类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testJoinNestedPojoAgainstTupleSelectedUsingString
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testJoinNestedPojoAgainstTupleSelectedUsingString() throws Exception {
/*
* Join nested pojo against tuple (selected using a string)
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> joinDs =
ds1.join(ds2).where("nestedPojo.longNumber").equalTo("f6");
List<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(1,First,10,100,1000,One,10000)\n" +
"2 Second (20,200,2000,Two) 20000,(2,Second,20,200,2000,Two,20000)\n" +
"3 Third (30,300,3000,Three) 30000,(3,Third,30,300,3000,Three,30000)\n";
compareResultAsTuples(result, expected);
}
示例2: testJoinNestedPojoAgainstTupleSelectedUsingInteger
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testJoinNestedPojoAgainstTupleSelectedUsingInteger() throws Exception {
/*
* Join nested pojo against tuple (selected as an integer)
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> joinDs =
ds1.join(ds2).where("nestedPojo.longNumber").equalTo(6); // <--- difference!
List<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(1,First,10,100,1000,One,10000)\n" +
"2 Second (20,200,2000,Two) 20000,(2,Second,20,200,2000,Two,20000)\n" +
"3 Third (30,300,3000,Three) 30000,(3,Third,30,300,3000,Three,30000)\n";
compareResultAsTuples(result, expected);
}
示例3: testSelectingMultipleFieldsUsingExpressionLanguage
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testSelectingMultipleFieldsUsingExpressionLanguage() throws Exception {
/*
* selecting multiple fields using expression language
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> joinDs =
ds1.join(ds2).where("nestedPojo.longNumber", "number", "str").equalTo("f6", "f0", "f1");
env.setParallelism(1);
List<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(1,First,10,100,1000,One,10000)\n" +
"2 Second (20,200,2000,Two) 20000,(2,Second,20,200,2000,Two,20000)\n" +
"3 Third (30,300,3000,Three) 30000,(3,Third,30,300,3000,Three,30000)\n";
compareResultAsTuples(result, expected);
}
示例4: testNestedIntoTuple
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testNestedIntoTuple() throws Exception {
/*
* nested into tuple
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> joinDs =
ds1.join(ds2).where("nestedPojo.longNumber", "number", "nestedTupleWithCustom.f0").equalTo("f6", "f0", "f2");
env.setParallelism(1);
List<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(1,First,10,100,1000,One,10000)\n" +
"2 Second (20,200,2000,Two) 20000,(2,Second,20,200,2000,Two,20000)\n" +
"3 Third (30,300,3000,Three) 30000,(3,Third,30,300,3000,Three,30000)\n";
compareResultAsTuples(result, expected);
}
示例5: testNestedIntoTupleIntoPojo
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testNestedIntoTupleIntoPojo() throws Exception {
/*
* nested into tuple into pojo
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> joinDs =
ds1.join(ds2).where("nestedTupleWithCustom.f0", "nestedTupleWithCustom.f1.myInt", "nestedTupleWithCustom.f1.myLong").equalTo("f2", "f3", "f4");
env.setParallelism(1);
List<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(1,First,10,100,1000,One,10000)\n" +
"2 Second (20,200,2000,Two) 20000,(2,Second,20,200,2000,Two,20000)\n" +
"3 Third (30,300,3000,Three) 30000,(3,Third,30,300,3000,Three,30000)\n";
compareResultAsTuples(result, expected);
}
示例6: testFullPojoWithFullTuple
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testFullPojoWithFullTuple() throws Exception {
/*
* full pojo with full tuple
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Long, Integer, Integer, Long, String, Integer, String>> ds2 = CollectionDataSets.getSmallTuplebasedDataSetMatchingPojo(env);
DataSet<Tuple2<POJO, Tuple7<Long, Integer, Integer, Long, String, Integer, String>>> joinDs =
ds1.join(ds2).where("*").equalTo("*");
env.setParallelism(1);
List<Tuple2<POJO, Tuple7<Long, Integer, Integer, Long, String, Integer, String>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(10000,10,100,1000,One,1,First)\n" +
"2 Second (20,200,2000,Two) 20000,(20000,20,200,2000,Two,2,Second)\n" +
"3 Third (30,300,3000,Three) 30000,(30000,30,300,3000,Three,3,Third)\n";
compareResultAsTuples(result, expected);
}
示例7: testJoinWithNestedKeyExpression1
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testJoinWithNestedKeyExpression1() throws Exception {
/*
* Join nested pojo against tuple (selected using a string)
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> joinDs =
ds1.fullOuterJoin(ds2)
.where("nestedPojo.longNumber")
.equalTo("f6")
.with(new ProjectBothFunction<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>());
List<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(1,First,10,100,1000,One,10000)\n" +
"2 Second (20,200,2000,Two) 20000,(2,Second,20,200,2000,Two,20000)\n" +
"3 Third (30,300,3000,Three) 30000,(3,Third,30,300,3000,Three,30000)\n";
compareResultAsTuples(result, expected);
}
示例8: testJoinWithNestedKeyExpression2
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testJoinWithNestedKeyExpression2() throws Exception {
/*
* Join nested pojo against tuple (selected as an integer)
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> joinDs =
ds1.fullOuterJoin(ds2)
.where("nestedPojo.longNumber")
.equalTo(6) // <--- difference!
.with(new ProjectBothFunction<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>());
List<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(1,First,10,100,1000,One,10000)\n" +
"2 Second (20,200,2000,Two) 20000,(2,Second,20,200,2000,Two,20000)\n" +
"3 Third (30,300,3000,Three) 30000,(3,Third,30,300,3000,Three,30000)\n";
compareResultAsTuples(result, expected);
}
示例9: testJoinWithCompositeKeyExpressions
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testJoinWithCompositeKeyExpressions() throws Exception {
/*
* selecting multiple fields using expression language
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> joinDs =
ds1.fullOuterJoin(ds2)
.where("nestedPojo.longNumber", "number", "str")
.equalTo("f6", "f0", "f1")
.with(new ProjectBothFunction<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>());
env.setParallelism(1);
List<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(1,First,10,100,1000,One,10000)\n" +
"2 Second (20,200,2000,Two) 20000,(2,Second,20,200,2000,Two,20000)\n" +
"3 Third (30,300,3000,Three) 30000,(3,Third,30,300,3000,Three,30000)\n";
compareResultAsTuples(result, expected);
}
示例10: testNestedIntoTuple
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testNestedIntoTuple() throws Exception {
/*
* nested into tuple
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> joinDs =
ds1.fullOuterJoin(ds2)
.where("nestedPojo.longNumber", "number", "nestedTupleWithCustom.f0")
.equalTo("f6", "f0", "f2")
.with(new ProjectBothFunction<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>());
env.setParallelism(1);
List<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(1,First,10,100,1000,One,10000)\n" +
"2 Second (20,200,2000,Two) 20000,(2,Second,20,200,2000,Two,20000)\n" +
"3 Third (30,300,3000,Three) 30000,(3,Third,30,300,3000,Three,30000)\n";
compareResultAsTuples(result, expected);
}
示例11: testNestedIntoTupleIntoPojo
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testNestedIntoTupleIntoPojo() throws Exception {
/*
* nested into tuple into pojo
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> joinDs =
ds1.fullOuterJoin(ds2)
.where("nestedTupleWithCustom.f0", "nestedTupleWithCustom.f1.myInt", "nestedTupleWithCustom.f1.myLong")
.equalTo("f2", "f3", "f4")
.with(new ProjectBothFunction<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>());
env.setParallelism(1);
List<Tuple2<POJO, Tuple7<Integer, String, Integer, Integer, Long, String, Long>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(1,First,10,100,1000,One,10000)\n" +
"2 Second (20,200,2000,Two) 20000,(2,Second,20,200,2000,Two,20000)\n" +
"3 Third (30,300,3000,Three) 30000,(3,Third,30,300,3000,Three,30000)\n";
compareResultAsTuples(result, expected);
}
示例12: testFullPojoWithFullTuple
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testFullPojoWithFullTuple() throws Exception {
/*
* full pojo with full tuple
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds1 = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Long, Integer, Integer, Long, String, Integer, String>> ds2 = CollectionDataSets.getSmallTuplebasedDataSetMatchingPojo(env);
DataSet<Tuple2<POJO, Tuple7<Long, Integer, Integer, Long, String, Integer, String>>> joinDs =
ds1.fullOuterJoin(ds2)
.where("*")
.equalTo("*")
.with(new ProjectBothFunction<POJO, Tuple7<Long, Integer, Integer, Long, String, Integer, String>>());
env.setParallelism(1);
List<Tuple2<POJO, Tuple7<Long, Integer, Integer, Long, String, Integer, String>>> result = joinDs.collect();
String expected = "1 First (10,100,1000,One) 10000,(10000,10,100,1000,One,1,First)\n" +
"2 Second (20,200,2000,Two) 20000,(20000,20,200,2000,Two,2,Second)\n" +
"3 Third (30,300,3000,Three) 30000,(30000,30,300,3000,Three,3,Third)\n";
compareResultAsTuples(result, expected);
}
示例13: testCoGroupOnTwoCustomTypeInputsWithExpressionKeyAndFieldSelector
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testCoGroupOnTwoCustomTypeInputsWithExpressionKeyAndFieldSelector() throws
Exception {
/*
* CoGroup on two custom type inputs using expression keys
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<CustomType> coGroupDs = ds.coGroup(ds2)
.where("nestedPojo.longNumber").equalTo(6).with(new CoGroup1());
List<CustomType> result = coGroupDs.collect();
String expected = "-1,20000,Flink\n" +
"-1,10000,Flink\n" +
"-1,30000,Flink\n";
compareResultAsText(result, expected);
}
示例14: testCoGroupFieldSelectorAndComplicatedKeySelector
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testCoGroupFieldSelectorAndComplicatedKeySelector() throws Exception {
/*
* CoGroup field-selector (expression keys) + key selector function
* The key selector is unnecessary complicated (Tuple1) ;)
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<CustomType> coGroupDs = ds.coGroup(ds2)
.where(new KeySelector6()).equalTo(6).with(new CoGroup3());
List<CustomType> result = coGroupDs.collect();
String expected = "-1,20000,Flink\n" +
"-1,10000,Flink\n" +
"-1,30000,Flink\n";
compareResultAsText(result, expected);
}
示例15: testCoGroupFieldSelectorAndKeySelector
import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testCoGroupFieldSelectorAndKeySelector() throws Exception {
/*
* CoGroup field-selector (expression keys) + key selector function
* The key selector is simple here
*/
final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
DataSet<POJO> ds = CollectionDataSets.getSmallPojoDataSet(env);
DataSet<Tuple7<Integer, String, Integer, Integer, Long, String, Long>> ds2 = CollectionDataSets.getSmallTuplebasedDataSet(env);
DataSet<CustomType> coGroupDs = ds.coGroup(ds2)
.where(new KeySelector1()).equalTo(6).with(new CoGroup2());
List<CustomType> result = coGroupDs.collect();
String expected = "-1,20000,Flink\n" +
"-1,10000,Flink\n" +
"-1,30000,Flink\n";
compareResultAsText(result, expected);
}