org.apache.flink.api.java.tuple.Tuple5 Java Examples

The following examples show how to use org.apache.flink.api.java.tuple.Tuple5. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DataSinkTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testTupleSingleOrderExp() {

	final ExecutionEnvironment env = ExecutionEnvironment
			.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env
			.fromCollection(emptyTupleData, tupleTypeInfo);

	// should work
	try {
		tupleDs.writeAsText("/tmp/willNotHappen")
			.sortLocalOutput("f0", Order.ANY);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
Example #2
Source File: JoinITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testJoinThatReturnsTheRightInputObject() throws Exception {
	/*
	 * Join that returns the right input object
	 */

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	DataSet<Tuple3<Integer, Long, String>> ds1 = CollectionDataSets.getSmall3TupleDataSet(env);
	DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds2 = CollectionDataSets.get5TupleDataSet(env);
	DataSet<Tuple5<Integer, Long, Integer, String, Long>> joinDs =
			ds1.join(ds2)
					.where(1)
					.equalTo(1)
					.with(new RightReturningJoin());

	List<Tuple5<Integer, Long, Integer, String, Long>> result = joinDs.collect();

	String expected = "1,1,0,Hallo,1\n" +
			"2,2,1,Hallo Welt,2\n" +
			"2,2,1,Hallo Welt,2\n";

	compareResultAsTuples(result, expected);
}
 
Example #3
Source File: JoinOperatorTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test(expected = InvalidProgramException.class)
public void testJoinKeyMixing3() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<CustomType> ds2 = env.fromCollection(customTypeData);

	// should not work, incompatible types
	ds1.join(ds2)
	.where(2)
	.equalTo(
			new KeySelector<CustomType, Long>() {

					@Override
					public Long getKey(CustomType value) {
						return value.myLong;
					}
				}
			);
}
 
Example #4
Source File: JoinITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testDefaultJoinOnTuples() throws Exception {
	/*
	 * Default Join on tuples
	 */

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	DataSet<Tuple3<Integer, Long, String>> ds1 = CollectionDataSets.getSmall3TupleDataSet(env);
	DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds2 = CollectionDataSets.get5TupleDataSet(env);
	DataSet<Tuple2<Tuple3<Integer, Long, String>, Tuple5<Integer, Long, Integer, String, Long>>> joinDs =
			ds1.join(ds2)
					.where(0)
					.equalTo(2);

	List<Tuple2<Tuple3<Integer, Long, String>, Tuple5<Integer, Long, Integer, String, Long>>> result = joinDs.collect();

	String expected = "(1,1,Hi),(2,2,1,Hallo Welt,2)\n" +
			"(2,2,Hello),(2,3,2,Hallo Welt wie,1)\n" +
			"(3,2,Hello world),(3,4,3,Hallo Welt wie gehts?,2)\n";

	compareResultAsTuples(result, expected);

}
 
Example #5
Source File: GroupReduceITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public void reduce(
		Iterable<Tuple5<Integer, Long, Integer, String, Long>> values,
		Collector<Tuple5<Integer, Long, Integer, String, Long>> out) {
	int i = 0;
	long l = 0L;
	long l2 = 0L;

	for (Tuple5<Integer, Long, Integer, String, Long> t : values) {
		i = t.f0;
		l += t.f1;
		l2 = t.f4;
	}

	out.collect(new Tuple5<>(i, l, 0, "P-)", l2));
}
 
Example #6
Source File: DataSinkTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testTupleTwoOrderExp() {

	final ExecutionEnvironment env = ExecutionEnvironment
			.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env
			.fromCollection(emptyTupleData, tupleTypeInfo);

	// should work
	try {
		tupleDs.writeAsText("/tmp/willNotHappen")
			.sortLocalOutput("f1", Order.ASCENDING)
			.sortLocalOutput("f4", Order.DESCENDING);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
Example #7
Source File: CoGroupOperatorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test(expected = InvalidProgramException.class)
public void testCoGroupKeyMixing4() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<CustomType> ds2 = env.fromCollection(customTypeData);

	// should not work, more than one key field position
	ds1.coGroup(ds2)
	.where(1, 3)
	.equalTo(
			new KeySelector<CustomType, Long>() {

					@Override
					public Long getKey(CustomType value) {
						return value.myLong;
					}
				}
			);
}
 
Example #8
Source File: CrossOperatorTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testCrossProjection27() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// should work
	try {
		ds1.cross(ds2)
			.projectSecond()
			.projectFirst(1, 4);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
Example #9
Source File: GroupReduceITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testTupleKeySelectorSortCombineOnTuple() throws Exception {
	/*
	 * check correctness of sorted groupReduceon with Tuple2 keyselector sorting
	 */

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	env.setParallelism(1);

	DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds = CollectionDataSets.get5TupleDataSet(env);
	DataSet<Tuple5<Integer, Long, Integer, String, Long>> reduceDs = ds
			.groupBy(new IntFieldExtractor<Tuple5<Integer, Long, Integer, String, Long>>(0))
			.sortGroup(new FiveToTwoTupleExtractor(), Order.DESCENDING)
			.reduceGroup(new Tuple5SortedGroupReduce());

	List<Tuple5<Integer, Long, Integer, String, Long>> result = reduceDs.collect();

	String expected = "1,1,0,Hallo,1\n"
			+
			"2,5,0,Hallo Welt-Hallo Welt wie,1\n" +
			"3,15,0,BCD-ABC-Hallo Welt wie gehts?,2\n" +
			"4,34,0,FGH-CDE-EFG-DEF,1\n" +
			"5,65,0,IJK-HIJ-KLM-JKL-GHI,1\n";

	compareResultAsTuples(result, expected);
}
 
Example #10
Source File: ValueCollectionDataSets.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public static DataSet<Tuple5<IntValue, LongValue, IntValue, StringValue, LongValue>> getSmall5TupleDataSet(ExecutionEnvironment env) {
	List<Tuple5<IntValue, LongValue, IntValue, StringValue, LongValue>> data = new ArrayList<>();

	data.add(new Tuple5<>(new IntValue(1), new LongValue(1L), new IntValue(0), new StringValue("Hallo"), new LongValue(1L)));
	data.add(new Tuple5<>(new IntValue(2), new LongValue(2L), new IntValue(1), new StringValue("Hallo Welt"), new LongValue(2L)));
	data.add(new Tuple5<>(new IntValue(2), new LongValue(3L), new IntValue(2), new StringValue("Hallo Welt wie"), new LongValue(1L)));

	Collections.shuffle(data);

	TupleTypeInfo<Tuple5<IntValue, LongValue, IntValue, StringValue, LongValue>> type = new
		TupleTypeInfo<>(
			ValueTypeInfo.INT_VALUE_TYPE_INFO,
			ValueTypeInfo.LONG_VALUE_TYPE_INFO,
			ValueTypeInfo.INT_VALUE_TYPE_INFO,
			ValueTypeInfo.STRING_VALUE_TYPE_INFO,
			ValueTypeInfo.LONG_VALUE_TYPE_INFO
	);

	return env.fromCollection(data, type);
}
 
Example #11
Source File: CoGroupITCase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testCoGroupWithMultipleKeyFieldsWithFieldSelector() throws Exception {
	/*
	 * CoGroup with multiple key fields
	 */

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds1 = CollectionDataSets.get5TupleDataSet(env);
	DataSet<Tuple3<Integer, Long, String>> ds2 = CollectionDataSets.get3TupleDataSet(env);

	DataSet<Tuple3<Integer, Long, String>> coGrouped = ds1.coGroup(ds2).
			where(0, 4).equalTo(0, 1).with(new Tuple5Tuple3CoGroup());

	List<Tuple3<Integer, Long, String>> result = coGrouped.collect();

	String expected = "1,1,Hallo\n" +
			"2,2,Hallo Welt\n" +
			"3,2,Hallo Welt wie gehts?\n" +
			"3,2,ABC\n" +
			"5,3,HIJ\n" +
			"5,3,IJK\n";

	compareResultAsTuples(result, expected);
}
 
Example #12
Source File: CoGroupITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testCoGroupWithBroadcastSet() throws Exception {
	/*
	 * Reduce with broadcast set
	 */

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	DataSet<Integer> intDs = CollectionDataSets.getIntegerDataSet(env);

	DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds = CollectionDataSets.get5TupleDataSet(env);
	DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds2 = CollectionDataSets.get5TupleDataSet(env);
	DataSet<Tuple3<Integer, Integer, Integer>> coGroupDs = ds.coGroup(ds2).where(0).equalTo(0).with(new Tuple5CoGroupBC()).withBroadcastSet(intDs, "ints");

	List<Tuple3<Integer, Integer, Integer>> result = coGroupDs.collect();

	String expected = "1,0,55\n" +
			"2,6,55\n" +
			"3,24,55\n" +
			"4,60,55\n" +
			"5,120,55\n";

	compareResultAsTuples(result, expected);
}
 
Example #13
Source File: AggregateOperatorTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testAggregationTypes() {
	try {
		final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
		DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);

		// should work: multiple aggregates
		tupleDs.aggregate(Aggregations.SUM, 0).and(Aggregations.MIN, 4);

		// should work: nested aggregates
		tupleDs.aggregate(Aggregations.MIN, 2).aggregate(Aggregations.SUM, 1);

		// should not work: average on string
		try {
			tupleDs.aggregate(Aggregations.SUM, 2);
			Assert.fail();
		} catch (UnsupportedAggregationTypeException iae) {
			// we're good here
		}
	}
	catch (Exception e) {
		System.err.println(e.getMessage());
		e.printStackTrace();
		Assert.fail(e.getMessage());
	}
}
 
Example #14
Source File: CrossITCase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Test
public void testCorrectnessOfCrossIfUDFReturnsLeftInputObject() throws Exception {
	/*
	 * check correctness of cross if UDF returns left input object
	 */

	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<Tuple3<Integer, Long, String>> crossDs = ds.cross(ds2).with(new Tuple3ReturnLeft());

	List<Tuple3<Integer, Long, String>> result = crossDs.collect();

	String expected = "1,1,Hi\n" +
			"1,1,Hi\n" +
			"1,1,Hi\n" +
			"2,2,Hello\n" +
			"2,2,Hello\n" +
			"2,2,Hello\n" +
			"3,2,Hello world\n" +
			"3,2,Hello world\n" +
			"3,2,Hello world\n";

	compareResultAsTuples(result, expected);
}
 
Example #15
Source File: CrossITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Override
public Tuple5<Integer, Long, Integer, String, Long> cross(
		Tuple3<Integer, Long, String> first,
		Tuple5<Integer, Long, Integer, String, Long> second)
		throws Exception {

	return second;
}
 
Example #16
Source File: CoGroupOperatorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testCoGroupKeyFields1() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// should work
	try {
		ds1.coGroup(ds2).where(0).equalTo(0);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
Example #17
Source File: CoGroupITCase.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testCoGroupOnACustomTypeWithKeyExtractorAndATupleInputWithKeyFieldSelector()
		throws Exception {
	/*
	 * CoGroup on a tuple input with key field selector and a custom type input with key extractor
	 */

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	DataSet<Tuple5<Integer, Long, Integer, String, Long>> ds = CollectionDataSets.get5TupleDataSet(env);
	DataSet<CustomType> ds2 = CollectionDataSets.getCustomTypeDataSet(env);
	DataSet<CustomType> coGroupDs = ds2.coGroup(ds).where(new KeySelector3()).equalTo(2).with
			(new MixedCoGroup2());

	List<CustomType> result = coGroupDs.collect();

	String expected = "0,1,test\n" +
			"1,2,test\n" +
			"2,5,test\n" +
			"3,15,test\n" +
			"4,33,test\n" +
			"5,63,test\n" +
			"6,109,test\n" +
			"7,4,test\n" +
			"8,4,test\n" +
			"9,4,test\n" +
			"10,5,test\n" +
			"11,5,test\n" +
			"12,5,test\n" +
			"13,5,test\n" +
			"14,5,test\n";

	compareResultAsText(result, expected);
}
 
Example #18
Source File: GroupingTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testChainedGroupSortKeyFields() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// should work
	try {
		tupleDs.groupBy(0).sortGroup(0, Order.ASCENDING).sortGroup(2, Order.DESCENDING);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
Example #19
Source File: CrossOperatorTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test(expected = IndexOutOfBoundsException.class)
public void testCrossProjection28() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// should not work, index out of range
	ds1.cross(ds2)
		.projectFirst(5);
}
 
Example #20
Source File: JoinITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void join(Tuple3<Integer, Long, String> first,
		Tuple5<Integer, Long, Integer, String, Long> second,
		Collector<Tuple2<String, String>> out) {

	out.collect(new Tuple2<String, String>(first.f2, second.f3));
}
 
Example #21
Source File: FullOuterJoinOperatorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test(expected = InvalidProgramException.class)
public void testFullOuter9() {
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// key types do not match
	ds1.fullOuterJoin(ds2)
			.where(0).equalTo(1)
			.with(new DummyJoin());
}
 
Example #22
Source File: GroupCombineOperatorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testSemanticPropsWithKeySelector5() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);

	GroupCombineOperator<Tuple5<Integer, Long, String, Long, Integer>, Tuple5<Integer, Long, String, Long, Integer>> combineOp =
			tupleDs.groupBy(new DummyTestKeySelector())
					.combineGroup(new DummyGroupCombineFunction3())
					.withForwardedFields("4->0;3;3->1;2");

	SemanticProperties semProps = combineOp.getSemanticProperties();

	assertTrue(semProps.getForwardingTargetFields(0, 0).size() == 0);
	assertTrue(semProps.getForwardingTargetFields(0, 1).size() == 0);
	assertTrue(semProps.getForwardingTargetFields(0, 2).size() == 0);
	assertTrue(semProps.getForwardingTargetFields(0, 3).size() == 0);
	assertTrue(semProps.getForwardingTargetFields(0, 4).size() == 1);
	assertTrue(semProps.getForwardingTargetFields(0, 4).contains(2));
	assertTrue(semProps.getForwardingTargetFields(0, 5).size() == 2);
	assertTrue(semProps.getForwardingTargetFields(0, 5).contains(1));
	assertTrue(semProps.getForwardingTargetFields(0, 5).contains(3));
	assertTrue(semProps.getForwardingTargetFields(0, 6).size() == 1);
	assertTrue(semProps.getForwardingTargetFields(0, 6).contains(0));

	assertTrue(semProps.getForwardingSourceField(0, 0) == 6);
	assertTrue(semProps.getForwardingSourceField(0, 1) == 5);
	assertTrue(semProps.getForwardingSourceField(0, 2) == 4);
	assertTrue(semProps.getForwardingSourceField(0, 3) == 5);
	assertTrue(semProps.getForwardingSourceField(0, 4) < 0);

	assertTrue(semProps.getReadFields(0) == null);
}
 
Example #23
Source File: JoinOperatorTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test(expected = IndexOutOfBoundsException.class)
public void testJoinProjection30() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// should not work, type does not match
	ds1.join(ds2).where(0).equalTo(0)
	.projectFirst(-1);
}
 
Example #24
Source File: JoinOperatorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testJoinKeyMixedTupleIndex() {
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	try {
		ds1.join(ds2).where("f0").equalTo(4);
	} catch (Exception e) {
		e.printStackTrace();
		Assert.fail();
	}
}
 
Example #25
Source File: CrossOperatorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testCrossProjection1() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// should work
	try {
		ds1.cross(ds2)
			.projectFirst(0);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
Example #26
Source File: FullOuterJoinOperatorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test(expected = CompositeType.InvalidFieldReferenceException.class)
public void testFullOuter8() {
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// invalid key reference
	ds1.fullOuterJoin(ds2)
			.where(1).equalTo("f5")
			.with(new DummyJoin());
}
 
Example #27
Source File: OuterJoinITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public void join(Tuple3<Integer, Long, String> first,
		Tuple5<Integer, Long, Integer, String, Long> second,
		Collector<Tuple2<String, String>> out) {

	out.collect(new Tuple2<>(first == null ? null : first.f2, second == null ? null : second.f3));
}
 
Example #28
Source File: JoinOperatorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
public void testJoinProjection11() {

		final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
		DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
		DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);

		// should not work, type does not match
		ds1.join(ds2).where(0).equalTo(0)
		.projectSecond(2);
	}
 
Example #29
Source File: CoGroupOperatorTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@Test
public void testCoGroupKeyFields1() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds1 = env.fromCollection(emptyTupleData, tupleTypeInfo);
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> ds2 = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// should work
	try {
		ds1.coGroup(ds2).where(0).equalTo(0);
	} catch (Exception e) {
		Assert.fail();
	}
}
 
Example #30
Source File: DistinctOperatorTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Test
public void testDistinctByKeyFields1() {

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
	DataSet<Tuple5<Integer, Long, String, Long, Integer>> tupleDs = env.fromCollection(emptyTupleData, tupleTypeInfo);

	// should work
	try {
		tupleDs.distinct(0);
	} catch (Exception e) {
		Assert.fail();
	}
}