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

Java Tuple7类代码示例

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

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



Tuple7类属于org.apache.flink.api.java.tuple包,在下文中一共展示了Tuple7类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:JoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:JoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:JoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:JoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:JoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:JoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:24,代码来源:OuterJoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:24,代码来源:OuterJoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:OuterJoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:OuterJoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:OuterJoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:OuterJoinITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:CoGroupITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:CoGroupITCase.java


示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:CoGroupITCase.java


示例16: 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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:CoGroupITCase.java


示例17: 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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:CoGroupITCase.java


示例18: 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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:23,代码来源:CoGroupITCase.java


示例19: testStandardTupleKeys

import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testStandardTupleKeys() {
	TupleTypeInfo<Tuple7<String, String, String, String, String, String, String>> typeInfo = new TupleTypeInfo<>(
			BasicTypeInfo.STRING_TYPE_INFO,BasicTypeInfo.STRING_TYPE_INFO,BasicTypeInfo.STRING_TYPE_INFO,BasicTypeInfo.STRING_TYPE_INFO,BasicTypeInfo.STRING_TYPE_INFO,
			BasicTypeInfo.STRING_TYPE_INFO,BasicTypeInfo.STRING_TYPE_INFO);
	
	ExpressionKeys<Tuple7<String, String, String, String, String, String, String>> ek;
	
	for( int i = 1; i < 8; i++) {
		int[] ints = new int[i];
		for( int j = 0; j < i; j++) {
			ints[j] = j;
		}
		int[] inInts = Arrays.copyOf(ints, ints.length); // copy, just to make sure that the code is not cheating by changing the ints.
		ek = new ExpressionKeys<>(inInts, typeInfo);
		Assert.assertArrayEquals(ints, ek.computeLogicalKeyPositions());
		Assert.assertEquals(ints.length, ek.computeLogicalKeyPositions().length);
		
		ArrayUtils.reverse(ints);
		inInts = Arrays.copyOf(ints, ints.length);
		ek = new ExpressionKeys<>(inInts, typeInfo);
		Assert.assertArrayEquals(ints, ek.computeLogicalKeyPositions());
		Assert.assertEquals(ints.length, ek.computeLogicalKeyPositions().length);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:26,代码来源:ExpressionKeysTest.java


示例20: testWorkingAggregationDataTypes

import org.apache.flink.api.java.tuple.Tuple7; //导入依赖的package包/类
@Test
public void testWorkingAggregationDataTypes() throws Exception {
	ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	BatchTableEnvironment tableEnv = TableEnvironment.getTableEnvironment(env, config());

	DataSource<Tuple7<Byte, Short, Integer, Long, Float, Double, String>> input =
			env.fromElements(
					new Tuple7<>((byte) 1, (short) 1, 1, 1L, 1.0f, 1.0d, "Hello"),
					new Tuple7<>((byte) 2, (short) 2, 2, 2L, 2.0f, 2.0d, "Ciao"));

	Table table = tableEnv.fromDataSet(input);

	Table result =
			table.select("f0.avg, f1.avg, f2.avg, f3.avg, f4.avg, f5.avg, f6.count");

	DataSet<Row> ds = tableEnv.toDataSet(result, Row.class);
	List<Row> results = ds.collect();
	String expected = "1,1,1,1,1.5,1.5,2";
	compareResultAsText(results, expected);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:AggregationsITCase.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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