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

The following examples show how to use org.apache.flink.streaming.api.datastream.CoGroupedStreams.TaggedUnion. 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: JoinedStreams.java    From Flink-CEPplus with 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 File: UnionSerializerTest.java    From flink with 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 File: JoinedStreams.java    From flink with 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 File: UnionSerializerTest.java    From Flink-CEPplus with 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 File: UnionSerializerTest.java    From flink with 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 #6
Source File: JoinedStreams.java    From flink with 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 #7
Source File: UnionSerializerTest.java    From flink with 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 File: UnionSerializerTest.java    From flink with 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 File: UnionSerializerTest.java    From flink with 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 #10
Source File: UnionSerializerTest.java    From flink with 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 #11
Source File: UnionSerializerTest.java    From Flink-CEPplus with 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 #12
Source File: UnionSerializerTest.java    From Flink-CEPplus with 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 #13
Source File: UnionSerializerUpgradeTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Matcher<TypeSerializerSchemaCompatibility<TaggedUnion<String, Long>>> schemaCompatibilityMatcher(MigrationVersion version) {
	return TypeSerializerMatchers.isCompatibleAsIs();
}
 
Example #14
Source File: UnionSerializerUpgradeTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Matcher<TaggedUnion<String, Long>> testDataMatcher() {
	return is(TaggedUnion.one("flink"));
}
 
Example #15
Source File: UnionSerializerUpgradeTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TypeSerializer<TaggedUnion<String, Long>> createUpgradedSerializer() {
	return new UnionSerializer<>(StringSerializer.INSTANCE, LongSerializer.INSTANCE);
}
 
Example #16
Source File: UnionSerializerUpgradeTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TaggedUnion<String, Long> createTestData() {
	return TaggedUnion.one("flink");
}
 
Example #17
Source File: UnionSerializerUpgradeTest.java    From flink with 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 #18
Source File: UnionSerializerUpgradeTest.java    From flink with 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 #19
Source File: UnionSerializerUpgradeTest.java    From flink with 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 #20
Source File: UnionSerializerUpgradeTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TaggedUnion<String, Long> createTestData() {
	return TaggedUnion.two(23456L);
}
 
Example #21
Source File: UnionSerializerUpgradeTest.java    From flink with Apache License 2.0 4 votes vote down vote up
public UnionSerializerUpgradeTest(TestSpecification<TaggedUnion<String, Long>, TaggedUnion<String, Long>> testSpecification) {
	super(testSpecification);
}
 
Example #22
Source File: UnionSerializerUpgradeTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public TypeSerializer<TaggedUnion<String, Long>> createUpgradedSerializer() {
	return new UnionSerializer<>(StringSerializer.INSTANCE, LongSerializer.INSTANCE);
}
 
Example #23
Source File: UnionSerializerUpgradeTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Matcher<TaggedUnion<String, Long>> testDataMatcher() {
	return is(TaggedUnion.two(23456L));
}
 
Example #24
Source File: UnionSerializerTest.java    From flink with 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 #25
Source File: JoinedStreams.java    From Flink-CEPplus with 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 #26
Source File: UnionSerializerUpgradeTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Override
public Matcher<TypeSerializerSchemaCompatibility<TaggedUnion<String, Long>>> schemaCompatibilityMatcher(MigrationVersion version) {
	return TypeSerializerMatchers.isCompatibleAsIs();
}
 
Example #27
Source File: JoinedStreams.java    From flink with 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 #28
Source File: JoinedStreams.java    From flink with 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 #29
Source File: UnionSerializerTest.java    From flink with 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 #30
Source File: UnionSerializerMigrationTest.java    From flink with Apache License 2.0 4 votes vote down vote up
private static TypeSerializer<TaggedUnion<String, Long>> stringLongRowSupplier() {
	return new UnionSerializer<>(StringSerializer.INSTANCE, LongSerializer.INSTANCE);
}