本文整理汇总了Java中org.apache.flink.streaming.api.TimeCharacteristic.ProcessingTime方法的典型用法代码示例。如果您正苦于以下问题:Java TimeCharacteristic.ProcessingTime方法的具体用法?Java TimeCharacteristic.ProcessingTime怎么用?Java TimeCharacteristic.ProcessingTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.streaming.api.TimeCharacteristic
的用法示例。
在下文中一共展示了TimeCharacteristic.ProcessingTime方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: AbstractSiddhiOperator
import org.apache.flink.streaming.api.TimeCharacteristic; //导入方法依赖的package包/类
/**
* @param siddhiPlan Siddhi CEP Execution Plan
*/
public AbstractSiddhiOperator(SiddhiOperatorContext siddhiPlan) {
validate(siddhiPlan);
this.executionExpression = siddhiPlan.getFinalExecutionPlan();
this.siddhiPlan = siddhiPlan;
this.isProcessingTime = this.siddhiPlan.getTimeCharacteristic() == TimeCharacteristic.ProcessingTime;
this.streamRecordSerializers = new HashMap<>();
registerStreamRecordSerializers();
}
示例2: AbstractSiddhiOperator
import org.apache.flink.streaming.api.TimeCharacteristic; //导入方法依赖的package包/类
/**
* @param siddhiPlan Siddhi CEP Execution Plan
*/
public AbstractSiddhiOperator(SiddhiOperatorContext siddhiPlan) {
validate(siddhiPlan);
this.executionExpression = siddhiPlan.getFinalExecutionPlan();
this.siddhiPlan = siddhiPlan;
this.isProcessingTime = this.siddhiPlan.getTimeCharacteristic() == TimeCharacteristic.ProcessingTime;
this.streamRecordSerializers = new HashMap<>();
registerStreamRecordSerializers();
}
示例3: createPatternStream
import org.apache.flink.streaming.api.TimeCharacteristic; //导入方法依赖的package包/类
private static <IN, OUT, K> SingleOutputStreamOperator<OUT> createPatternStream(
final DataStream<IN> inputStream,
final Pattern<IN, ?> pattern,
final TypeInformation<OUT> outTypeInfo,
final boolean timeoutHandling,
final EventComparator<IN> comparator,
final OperatorBuilder<IN, OUT> operatorBuilder) {
final TypeSerializer<IN> inputSerializer = inputStream.getType().createSerializer(inputStream.getExecutionConfig());
// check whether we use processing time
final boolean isProcessingTime = inputStream.getExecutionEnvironment().getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime;
// compile our pattern into a NFAFactory to instantiate NFAs later on
final NFACompiler.NFAFactory<IN> nfaFactory = NFACompiler.compileFactory(pattern, inputSerializer, timeoutHandling);
final SingleOutputStreamOperator<OUT> patternStream;
if (inputStream instanceof KeyedStream) {
KeyedStream<IN, K> keyedStream = (KeyedStream<IN, K>) inputStream;
patternStream = keyedStream.transform(
operatorBuilder.getKeyedOperatorName(),
outTypeInfo,
operatorBuilder.build(
inputSerializer,
isProcessingTime,
nfaFactory,
comparator,
pattern.getAfterMatchSkipStrategy()));
} else {
KeySelector<IN, Byte> keySelector = new NullByteKeySelector<>();
patternStream = inputStream.keyBy(keySelector).transform(
operatorBuilder.getOperatorName(),
outTypeInfo,
operatorBuilder.build(
inputSerializer,
isProcessingTime,
nfaFactory,
comparator,
pattern.getAfterMatchSkipStrategy()
)).forceNonParallel();
}
return patternStream;
}
示例4: select
import org.apache.flink.streaming.api.TimeCharacteristic; //导入方法依赖的package包/类
/**
* Applies a select function to the detected pattern sequence or query results. For each pattern sequence or query result the
* provided {@link EsperSelectFunction} is called. The pattern select function can produce
* exactly one resulting element.
*
* @param esperSelectFunction The pattern select function which is called for each detected pattern sequence.
* @param <R> Type of the resulting elements
* @return {@link DataStream} which contains the resulting elements from the pattern select
* function.
*/
public <R> SingleOutputStreamOperator<R> select(EsperSelectFunction<R> esperSelectFunction) {
KeySelector<IN, Byte> keySelector = new NullByteKeySelector<>();
SingleOutputStreamOperator<R> patternStream;
TypeInformation<R> typeInformation = getTypeInformation(esperSelectFunction);
final boolean isProcessingTime = inputStream.getExecutionEnvironment().getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime;
patternStream = inputStream.keyBy(keySelector).transform("SelectEsperOperator", typeInformation, new SelectEsperStreamOperator<Byte, IN, R>(inputStream.getType(), esperSelectFunction, isProcessingTime, esperQuery));
return patternStream;
}
示例5: timeWindowAll
import org.apache.flink.streaming.api.TimeCharacteristic; //导入方法依赖的package包/类
/**
* Windows this {@code DataStream} into tumbling time windows.
*
* <p>This is a shortcut for either {@code .window(TumblingEventTimeWindows.of(size))} or
* {@code .window(TumblingProcessingTimeWindows.of(size))} depending on the time characteristic
* set using
*
* <p>Note: This operation can be inherently non-parallel since all elements have to pass through
* the same operator instance. (Only for special cases, such as aligned time windows is
* it possible to perform this operation in parallel).
*
* {@link org.apache.flink.streaming.api.environment.StreamExecutionEnvironment#setStreamTimeCharacteristic(org.apache.flink.streaming.api.TimeCharacteristic)}
*
* @param size The size of the window.
*/
public AllWindowedStream<T, TimeWindow> timeWindowAll(Time size) {
if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) {
return windowAll(TumblingProcessingTimeWindows.of(size));
} else {
return windowAll(TumblingEventTimeWindows.of(size));
}
}
示例6: timeWindow
import org.apache.flink.streaming.api.TimeCharacteristic; //导入方法依赖的package包/类
/**
* Windows this {@code KeyedStream} into tumbling time windows.
*
* <p>This is a shortcut for either {@code .window(TumblingEventTimeWindows.of(size))} or
* {@code .window(TumblingProcessingTimeWindows.of(size))} depending on the time characteristic
* set using
* {@link org.apache.flink.streaming.api.environment.StreamExecutionEnvironment#setStreamTimeCharacteristic(org.apache.flink.streaming.api.TimeCharacteristic)}
*
* @param size The size of the window.
*/
public WindowedStream<T, KEY, TimeWindow> timeWindow(Time size) {
if (environment.getStreamTimeCharacteristic() == TimeCharacteristic.ProcessingTime) {
return window(TumblingProcessingTimeWindows.of(size));
} else {
return window(TumblingEventTimeWindows.of(size));
}
}
示例7: setStreamTimeCharacteristic
import org.apache.flink.streaming.api.TimeCharacteristic; //导入方法依赖的package包/类
/**
* Sets the time characteristic for all streams create from this environment, e.g., processing
* time, event time, or ingestion time.
*
* <p>If you set the characteristic to IngestionTime of EventTime this will set a default
* watermark update interval of 200 ms. If this is not applicable for your application
* you should change it using {@link ExecutionConfig#setAutoWatermarkInterval(long)}.
*
* @param characteristic The time characteristic.
*/
@PublicEvolving
public void setStreamTimeCharacteristic(TimeCharacteristic characteristic) {
this.timeCharacteristic = Preconditions.checkNotNull(characteristic);
if (characteristic == TimeCharacteristic.ProcessingTime) {
getConfig().setAutoWatermarkInterval(0);
} else {
getConfig().setAutoWatermarkInterval(200);
}
}