org.apache.flink.api.java.functions.NullByteKeySelector Java Examples

The following examples show how to use org.apache.flink.api.java.functions.NullByteKeySelector. 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: AllWindowedStream.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
@PublicEvolving
public AllWindowedStream(DataStream<T> input,
		WindowAssigner<? super T, W> windowAssigner) {
	this.input = input.keyBy(new NullByteKeySelector<T>());
	this.windowAssigner = windowAssigner;
	this.trigger = windowAssigner.getDefaultTrigger(input.getExecutionEnvironment());
}
 
Example #2
Source File: AllWindowedStream.java    From flink with Apache License 2.0 5 votes vote down vote up
@PublicEvolving
public AllWindowedStream(DataStream<T> input,
		WindowAssigner<? super T, W> windowAssigner) {
	this.input = input.keyBy(new NullByteKeySelector<T>());
	this.windowAssigner = windowAssigner;
	this.trigger = windowAssigner.getDefaultTrigger(input.getExecutionEnvironment());
}
 
Example #3
Source File: AllWindowedStream.java    From flink with Apache License 2.0 5 votes vote down vote up
@PublicEvolving
public AllWindowedStream(DataStream<T> input,
		WindowAssigner<? super T, W> windowAssigner) {
	this.input = input.keyBy(new NullByteKeySelector<T>());
	this.windowAssigner = windowAssigner;
	this.trigger = windowAssigner.getDefaultTrigger(input.getExecutionEnvironment());
}
 
Example #4
Source File: PatternStreamBuilder.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a data stream containing results of {@link PatternProcessFunction} to fully matching event patterns.
 *
 * @param processFunction function to be applied to matching event sequences
 * @param outTypeInfo output TypeInformation of
 *        {@link PatternProcessFunction#processMatch(Map, PatternProcessFunction.Context, Collector)}
 * @param <OUT> type of output events
 * @return Data stream containing fully matched event sequence with applied {@link PatternProcessFunction}
 */
<OUT, K> SingleOutputStreamOperator<OUT> build(
		final TypeInformation<OUT> outTypeInfo,
		final PatternProcessFunction<IN, OUT> processFunction) {

	checkNotNull(outTypeInfo);
	checkNotNull(processFunction);

	final TypeSerializer<IN> inputSerializer = inputStream.getType().createSerializer(inputStream.getExecutionConfig());
	final boolean isProcessingTime = inputStream.getExecutionEnvironment().getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime;

	final boolean timeoutHandling = processFunction instanceof TimedOutPartialMatchHandler;
	final NFACompiler.NFAFactory<IN> nfaFactory = NFACompiler.compileFactory(pattern, timeoutHandling);

	final CepOperator<IN, K, OUT> operator = new CepOperator<>(
		inputSerializer,
		isProcessingTime,
		nfaFactory,
		comparator,
		pattern.getAfterMatchSkipStrategy(),
		processFunction,
		lateDataOutputTag);

	final SingleOutputStreamOperator<OUT> patternStream;
	if (inputStream instanceof KeyedStream) {
		KeyedStream<IN, K> keyedStream = (KeyedStream<IN, K>) inputStream;

		patternStream = keyedStream.transform(
			"CepOperator",
			outTypeInfo,
			operator);
	} else {
		KeySelector<IN, Byte> keySelector = new NullByteKeySelector<>();

		patternStream = inputStream.keyBy(keySelector).transform(
			"GlobalCepOperator",
			outTypeInfo,
			operator
		).forceNonParallel();
	}

	return patternStream;
}
 
Example #5
Source File: PatternStreamBuilder.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a data stream containing results of {@link PatternProcessFunction} to fully matching event patterns.
 *
 * @param processFunction function to be applied to matching event sequences
 * @param outTypeInfo output TypeInformation of
 *        {@link PatternProcessFunction#processMatch(Map, PatternProcessFunction.Context, Collector)}
 * @param <OUT> type of output events
 * @return Data stream containing fully matched event sequence with applied {@link PatternProcessFunction}
 */
<OUT, K> SingleOutputStreamOperator<OUT> build(
		final TypeInformation<OUT> outTypeInfo,
		final PatternProcessFunction<IN, OUT> processFunction) {

	checkNotNull(outTypeInfo);
	checkNotNull(processFunction);

	final TypeSerializer<IN> inputSerializer = inputStream.getType().createSerializer(inputStream.getExecutionConfig());
	final boolean isProcessingTime = inputStream.getExecutionEnvironment().getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime;

	final boolean timeoutHandling = processFunction instanceof TimedOutPartialMatchHandler;
	final NFACompiler.NFAFactory<IN> nfaFactory = NFACompiler.compileFactory(pattern, timeoutHandling);

	final CepOperator<IN, K, OUT> operator = new CepOperator<>(
		inputSerializer,
		isProcessingTime,
		nfaFactory,
		comparator,
		pattern.getAfterMatchSkipStrategy(),
		processFunction,
		lateDataOutputTag);

	final SingleOutputStreamOperator<OUT> patternStream;
	if (inputStream instanceof KeyedStream) {
		KeyedStream<IN, K> keyedStream = (KeyedStream<IN, K>) inputStream;

		patternStream = keyedStream.transform(
			"CepOperator",
			outTypeInfo,
			operator);
	} else {
		KeySelector<IN, Byte> keySelector = new NullByteKeySelector<>();

		patternStream = inputStream.keyBy(keySelector).transform(
			"GlobalCepOperator",
			outTypeInfo,
			operator
		).forceNonParallel();
	}

	return patternStream;
}
 
Example #6
Source File: PatternStreamBuilder.java    From flink with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a data stream containing results of {@link PatternProcessFunction} to fully matching event patterns.
 *
 * @param processFunction function to be applied to matching event sequences
 * @param outTypeInfo output TypeInformation of
 *        {@link PatternProcessFunction#processMatch(Map, PatternProcessFunction.Context, Collector)}
 * @param <OUT> type of output events
 * @return Data stream containing fully matched event sequence with applied {@link PatternProcessFunction}
 */
<OUT, K> SingleOutputStreamOperator<OUT> build(
		final TypeInformation<OUT> outTypeInfo,
		final PatternProcessFunction<IN, OUT> processFunction) {

	checkNotNull(outTypeInfo);
	checkNotNull(processFunction);

	final TypeSerializer<IN> inputSerializer = inputStream.getType().createSerializer(inputStream.getExecutionConfig());
	final boolean isProcessingTime = inputStream.getExecutionEnvironment().getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime;

	final boolean timeoutHandling = processFunction instanceof TimedOutPartialMatchHandler;
	final NFACompiler.NFAFactory<IN> nfaFactory = NFACompiler.compileFactory(pattern, timeoutHandling);

	final CepOperator<IN, K, OUT> operator = new CepOperator<>(
		inputSerializer,
		isProcessingTime,
		nfaFactory,
		comparator,
		pattern.getAfterMatchSkipStrategy(),
		processFunction,
		lateDataOutputTag);

	final SingleOutputStreamOperator<OUT> patternStream;
	if (inputStream instanceof KeyedStream) {
		KeyedStream<IN, K> keyedStream = (KeyedStream<IN, K>) inputStream;

		patternStream = keyedStream.transform(
			"CepOperator",
			outTypeInfo,
			operator);
	} else {
		KeySelector<IN, Byte> keySelector = new NullByteKeySelector<>();

		patternStream = inputStream.keyBy(keySelector).transform(
			"GlobalCepOperator",
			outTypeInfo,
			operator
		).forceNonParallel();
	}

	return patternStream;
}