Java Code Examples for org.apache.flink.streaming.api.datastream.CoGroupedStreams.TaggedUnion

The following examples show how to use org.apache.flink.streaming.api.datastream.CoGroupedStreams.TaggedUnion. These examples are extracted from open source projects. 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 Project: Flink-CEPplus   Source File: JoinedStreams.java    License: Apache License 2.0 6 votes vote down vote up
@PublicEvolving
protected WithWindow(DataStream<T1> input1,
		DataStream<T2> input2,
		KeySelector<T1, KEY> keySelector1,
		KeySelector<T2, KEY> keySelector2,
		TypeInformation<KEY> keyType,
		WindowAssigner<? super TaggedUnion<T1, T2>, W> windowAssigner,
		Trigger<? super TaggedUnion<T1, T2>, ? super W> trigger,
		Evictor<? super TaggedUnion<T1, T2>, ? super W> evictor,
		Time allowedLateness) {

	this.input1 = requireNonNull(input1);
	this.input2 = requireNonNull(input2);

	this.keySelector1 = requireNonNull(keySelector1);
	this.keySelector2 = requireNonNull(keySelector2);
	this.keyType = requireNonNull(keyType);

	this.windowAssigner = requireNonNull(windowAssigner);

	this.trigger = trigger;
	this.evictor = evictor;

	this.allowedLateness = allowedLateness;
}
 
Example 2
Source Project: Flink-CEPplus   Source File: UnionSerializerTest.java    License: Apache License 2.0 6 votes vote down vote up
public UnionSerializerTest() {
	super(new DeeplyEqualsChecker()
		.withCustomCheck(
			(o1, o2) -> o1 instanceof TaggedUnion && o2 instanceof TaggedUnion,
			(o1, o2, checker) -> {
				TaggedUnion union1 = (TaggedUnion) o1;
				TaggedUnion union2 = (TaggedUnion) o2;

				if (union1.isOne() && union2.isOne()) {
					return checker.deepEquals(union1.getOne(), union2.getOne());
				} else if (union1.isTwo() && union2.isTwo()) {
					return checker.deepEquals(union1.getTwo(), union2.getTwo());
				} else {
					return false;
				}
			}
		));
}
 
Example 3
Source Project: flink   Source File: JoinedStreams.java    License: Apache License 2.0 6 votes vote down vote up
@PublicEvolving
protected WithWindow(DataStream<T1> input1,
		DataStream<T2> input2,
		KeySelector<T1, KEY> keySelector1,
		KeySelector<T2, KEY> keySelector2,
		TypeInformation<KEY> keyType,
		WindowAssigner<? super TaggedUnion<T1, T2>, W> windowAssigner,
		Trigger<? super TaggedUnion<T1, T2>, ? super W> trigger,
		Evictor<? super TaggedUnion<T1, T2>, ? super W> evictor,
		Time allowedLateness) {

	this.input1 = requireNonNull(input1);
	this.input2 = requireNonNull(input2);

	this.keySelector1 = requireNonNull(keySelector1);
	this.keySelector2 = requireNonNull(keySelector2);
	this.keyType = requireNonNull(keyType);

	this.windowAssigner = requireNonNull(windowAssigner);

	this.trigger = trigger;
	this.evictor = evictor;

	this.allowedLateness = allowedLateness;
}
 
Example 4
Source Project: flink   Source File: UnionSerializerTest.java    License: Apache License 2.0 6 votes vote down vote up
public UnionSerializerTest() {
	super(new DeeplyEqualsChecker()
	.withCustomCheck(
		(o1, o2) -> o1 instanceof TaggedUnion && o2 instanceof TaggedUnion,
		(o1, o2, checker) -> {
			TaggedUnion union1 = (TaggedUnion) o1;
			TaggedUnion union2 = (TaggedUnion) o2;

			if (union1.isOne() && union2.isOne()) {
				return checker.deepEquals(union1.getOne(), union2.getOne());
			} else if (union1.isTwo() && union2.isTwo()) {
				return checker.deepEquals(union1.getTwo(), union2.getTwo());
			} else {
				return false;
			}
		}
	));
}
 
Example 5
Source Project: flink   Source File: JoinedStreams.java    License: Apache License 2.0 6 votes vote down vote up
@PublicEvolving
protected WithWindow(DataStream<T1> input1,
		DataStream<T2> input2,
		KeySelector<T1, KEY> keySelector1,
		KeySelector<T2, KEY> keySelector2,
		TypeInformation<KEY> keyType,
		WindowAssigner<? super TaggedUnion<T1, T2>, W> windowAssigner,
		Trigger<? super TaggedUnion<T1, T2>, ? super W> trigger,
		Evictor<? super TaggedUnion<T1, T2>, ? super W> evictor,
		Time allowedLateness) {

	this.input1 = requireNonNull(input1);
	this.input2 = requireNonNull(input2);

	this.keySelector1 = requireNonNull(keySelector1);
	this.keySelector2 = requireNonNull(keySelector2);
	this.keyType = requireNonNull(keyType);

	this.windowAssigner = requireNonNull(windowAssigner);

	this.trigger = trigger;
	this.evictor = evictor;

	this.allowedLateness = allowedLateness;
}
 
Example 6
Source Project: flink   Source File: UnionSerializerTest.java    License: Apache License 2.0 6 votes vote down vote up
public UnionSerializerTest() {
	super(new DeeplyEqualsChecker()
	.withCustomCheck(
		(o1, o2) -> o1 instanceof TaggedUnion && o2 instanceof TaggedUnion,
		(o1, o2, checker) -> {
			TaggedUnion union1 = (TaggedUnion) o1;
			TaggedUnion union2 = (TaggedUnion) o2;

			if (union1.isOne() && union2.isOne()) {
				return checker.deepEquals(union1.getOne(), union2.getOne());
			} else if (union1.isTwo() && union2.isTwo()) {
				return checker.deepEquals(union1.getTwo(), union2.getTwo());
			} else {
				return false;
			}
		}
	));
}
 
Example 7
Source Project: Flink-CEPplus   Source File: UnionSerializerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected TypeSerializer<TaggedUnion<Object, Object>> createSerializer() {
	return new UnionSerializer<>(
		new KryoSerializer<>(Object.class, new ExecutionConfig()),
		new KryoSerializer<>(Object.class, new ExecutionConfig())
	);
}
 
Example 8
Source Project: Flink-CEPplus   Source File: UnionSerializerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected TaggedUnion<Object, Object>[] getTestData() {
	return new TaggedUnion[]{
		TaggedUnion.one(1),
		TaggedUnion.two("A"),
		TaggedUnion.one("C")
	};
}
 
Example 9
Source Project: flink   Source File: UnionSerializerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected TypeSerializer<TaggedUnion<Object, Object>> createSerializer() {
	return new UnionSerializer<>(
		new KryoSerializer<>(Object.class, new ExecutionConfig()),
		new KryoSerializer<>(Object.class, new ExecutionConfig())
	);
}
 
Example 10
Source Project: flink   Source File: UnionSerializerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected TaggedUnion<Object, Object>[] getTestData() {
	return new TaggedUnion[]{
		TaggedUnion.one(1),
		TaggedUnion.two("A"),
		TaggedUnion.one("C")
	};
}
 
Example 11
Source Project: flink   Source File: UnionSerializerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected TypeSerializer<TaggedUnion<Object, Object>> createSerializer() {
	return new UnionSerializer<>(
		new KryoSerializer<>(Object.class, new ExecutionConfig()),
		new KryoSerializer<>(Object.class, new ExecutionConfig())
	);
}
 
Example 12
Source Project: flink   Source File: UnionSerializerTest.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected TaggedUnion<Object, Object>[] getTestData() {
	return new TaggedUnion[]{
		TaggedUnion.one(1),
		TaggedUnion.two("A"),
		TaggedUnion.one("C")
	};
}
 
Example 13
Source Project: Flink-CEPplus   Source File: JoinedStreams.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Specifies the window on which the join operation works.
 */
@PublicEvolving
public <W extends Window> WithWindow<T1, T2, KEY, W> window(WindowAssigner<? super TaggedUnion<T1, T2>, W> assigner) {
	return new WithWindow<>(input1, input2, keySelector1, keySelector2, keyType, assigner, null, null, null);
}
 
Example 14
Source Project: Flink-CEPplus   Source File: JoinedStreams.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Sets the {@code Trigger} that should be used to trigger window emission.
 */
@PublicEvolving
public WithWindow<T1, T2, KEY, W> trigger(Trigger<? super TaggedUnion<T1, T2>, ? super W> newTrigger) {
	return new WithWindow<>(input1, input2, keySelector1, keySelector2, keyType,
			windowAssigner, newTrigger, evictor, allowedLateness);
}
 
Example 15
public UnionSerializerMigrationTest(TestSpecification<TaggedUnion<String, Long>> testSpecification) {
	super(testSpecification);
}
 
Example 16
private static TypeSerializer<TaggedUnion<String, Long>> stringLongRowSupplier() {
	return new UnionSerializer<>(StringSerializer.INSTANCE, LongSerializer.INSTANCE);
}
 
Example 17
Source Project: Flink-CEPplus   Source File: UnionSerializerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected Class<TaggedUnion<Object, Object>> getTypeClass() {
	return (Class<TaggedUnion<Object, Object>>) (Class<?>) TaggedUnion.class;
}
 
Example 18
Source Project: flink   Source File: JoinedStreams.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Specifies the window on which the join operation works.
 */
@PublicEvolving
public <W extends Window> WithWindow<T1, T2, KEY, W> window(WindowAssigner<? super TaggedUnion<T1, T2>, W> assigner) {
	return new WithWindow<>(input1, input2, keySelector1, keySelector2, keyType, assigner, null, null, null);
}
 
Example 19
Source Project: flink   Source File: JoinedStreams.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Sets the {@code Trigger} that should be used to trigger window emission.
 */
@PublicEvolving
public WithWindow<T1, T2, KEY, W> trigger(Trigger<? super TaggedUnion<T1, T2>, ? super W> newTrigger) {
	return new WithWindow<>(input1, input2, keySelector1, keySelector2, keyType,
			windowAssigner, newTrigger, evictor, allowedLateness);
}
 
Example 20
Source Project: flink   Source File: UnionSerializerMigrationTest.java    License: Apache License 2.0 4 votes vote down vote up
public UnionSerializerMigrationTest(TestSpecification<TaggedUnion<String, Long>> testSpecification) {
	super(testSpecification);
}
 
Example 21
Source Project: flink   Source File: UnionSerializerMigrationTest.java    License: Apache License 2.0 4 votes vote down vote up
private static TypeSerializer<TaggedUnion<String, Long>> stringLongRowSupplier() {
	return new UnionSerializer<>(StringSerializer.INSTANCE, LongSerializer.INSTANCE);
}
 
Example 22
Source Project: flink   Source File: UnionSerializerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected Class<TaggedUnion<Object, Object>> getTypeClass() {
	return (Class<TaggedUnion<Object, Object>>) (Class<?>) TaggedUnion.class;
}
 
Example 23
Source Project: flink   Source File: JoinedStreams.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Specifies the window on which the join operation works.
 */
@PublicEvolving
public <W extends Window> WithWindow<T1, T2, KEY, W> window(WindowAssigner<? super TaggedUnion<T1, T2>, W> assigner) {
	return new WithWindow<>(input1, input2, keySelector1, keySelector2, keyType, assigner, null, null, null);
}
 
Example 24
Source Project: flink   Source File: JoinedStreams.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Sets the {@code Trigger} that should be used to trigger window emission.
 */
@PublicEvolving
public WithWindow<T1, T2, KEY, W> trigger(Trigger<? super TaggedUnion<T1, T2>, ? super W> newTrigger) {
	return new WithWindow<>(input1, input2, keySelector1, keySelector2, keyType,
			windowAssigner, newTrigger, evictor, allowedLateness);
}
 
Example 25
Source Project: flink   Source File: UnionSerializerTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
protected Class<TaggedUnion<Object, Object>> getTypeClass() {
	return (Class<TaggedUnion<Object, Object>>) (Class<?>) TaggedUnion.class;
}
 
Example 26
Source Project: flink   Source File: UnionSerializerUpgradeTest.java    License: Apache License 2.0 4 votes vote down vote up
public UnionSerializerUpgradeTest(TestSpecification<TaggedUnion<String, Long>, TaggedUnion<String, Long>> testSpecification) {
	super(testSpecification);
}
 
Example 27
Source Project: flink   Source File: UnionSerializerUpgradeTest.java    License: Apache License 2.0 4 votes vote down vote up
private static TypeSerializer<TaggedUnion<String, Long>> stringLongRowSupplier() {
	return new UnionSerializer<>(StringSerializer.INSTANCE, LongSerializer.INSTANCE);
}
 
Example 28
Source Project: flink   Source File: UnionSerializerUpgradeTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public TypeSerializer<TaggedUnion<String, Long>> createPriorSerializer() {
	return new UnionSerializer<>(StringSerializer.INSTANCE, LongSerializer.INSTANCE);
}
 
Example 29
Source Project: flink   Source File: UnionSerializerUpgradeTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public TaggedUnion<String, Long> createTestData() {
	return TaggedUnion.one("flink");
}
 
Example 30
Source Project: flink   Source File: UnionSerializerUpgradeTest.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public TypeSerializer<TaggedUnion<String, Long>> createUpgradedSerializer() {
	return new UnionSerializer<>(StringSerializer.INSTANCE, LongSerializer.INSTANCE);
}