本文整理了Java中org.apache.flink.streaming.api.operators.Output.collect()
方法的一些代码示例,展示了Output.collect()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Output.collect()
方法的具体详情如下:
包路径:org.apache.flink.streaming.api.operators.Output
类名称:Output
方法名:collect
[英]Emits a record the side output identified by the given OutputTag.
[中]发出一条记录,记录由给定OutputTag标识的侧面输出。
代码示例来源:origin: apache/flink
/**
* Write skipped late arriving element to SideOutput.
*
* @param element skipped late arriving element to side output
*/
protected void sideOutput(StreamRecord<IN> element){
output.collect(lateDataOutputTag, element);
}
代码示例来源:origin: apache/flink
@Override
public void collect(StreamRecord<T> record) {
for (Output<StreamRecord<T>> output : outputs) {
output.collect(record);
}
}
代码示例来源:origin: apache/flink
@Override
public void processElement(StreamRecord<IN> record) throws Exception {
output.collect(record);
}
代码示例来源:origin: apache/flink
@Override
public <X> void collect(OutputTag<X> outputTag, StreamRecord<X> record) {
for (Output<StreamRecord<T>> output : outputs) {
output.collect(outputTag, record);
}
}
代码示例来源:origin: apache/flink
@Override
public void collect(StreamRecord<T> record) {
for (int i = 0; i < outputs.length - 1; i++) {
Output<StreamRecord<T>> output = outputs[i];
StreamRecord<T> shallowCopy = record.copy(record.getValue());
output.collect(shallowCopy);
}
if (outputs.length > 0) {
// don't copy for the last output
outputs[outputs.length - 1].collect(record);
}
}
代码示例来源:origin: apache/flink
@Override
public void processElement2(StreamRecord<String> element) {
output.collect(element);
output.collect(element);
}
}
代码示例来源:origin: apache/flink
@Override
public void processElement(StreamRecord<String> element) {
output.collect(element);
output.collect(element);
}
}
代码示例来源:origin: apache/flink
@Override
public void collect(StreamRecord<OUT> record) {
numRecordsOut.inc();
output.collect(record);
}
代码示例来源:origin: apache/flink
@Override
public <X> void collect(OutputTag<X> outputTag, StreamRecord<X> record) {
numRecordsOut.inc();
output.collect(outputTag, record);
}
代码示例来源:origin: apache/flink
@Override
public void processElement2(StreamRecord<Integer> element) throws Exception {
output.collect(element);
}
代码示例来源:origin: apache/flink
@Override
public void processElement(StreamRecord<String> element) throws Exception {
output.collect(element);
}
代码示例来源:origin: apache/flink
@Override
public void processElement2(StreamRecord<IN2> element) throws Exception {
output.collect(element.replace(userFunction.map2(element.getValue())));
}
}
代码示例来源:origin: apache/flink
@Override
public void processElement(StreamRecord<Integer> element) throws Exception {
if (element.hasTimestamp()) {
Assert.fail("Timestamps are not properly handled.");
}
output.collect(element);
}
}
代码示例来源:origin: apache/flink
@Override
public void processElement(StreamRecord<T> element) throws Exception {
final long newTimestamp = userFunction.extractTimestamp(element.getValue(),
element.hasTimestamp() ? element.getTimestamp() : Long.MIN_VALUE);
output.collect(element.replace(element.getValue(), newTimestamp));
}
代码示例来源:origin: apache/flink
@Override
public void onEventTime(InternalTimer<Integer, VoidNamespace> timer) throws Exception {
String stateValue = getPartitionedState(stateDescriptor).value();
output.collect(new StreamRecord<>("ON_EVENT_TIME:" + stateValue));
}
代码示例来源:origin: apache/flink
@Override
public void onProcessingTime(InternalTimer<Integer, VoidNamespace> timer) throws Exception {
String stateValue = getPartitionedState(stateDescriptor).value();
output.collect(new StreamRecord<>("ON_PROC_TIME:" + stateValue));
}
}
代码示例来源:origin: apache/flink
@Override
public void processElement(StreamRecord<T> element) throws Exception {
long newTimestamp = userFunction.extractTimestamp(element.getValue(), element.getTimestamp());
output.collect(element.replace(element.getValue(), newTimestamp));
long watermark = userFunction.extractWatermark(element.getValue(), newTimestamp);
if (watermark > currentWatermark) {
currentWatermark = watermark;
output.emitWatermark(new Watermark(currentWatermark));
}
}
代码示例来源:origin: apache/flink
@Override
public void processElement(StreamRecord<T> element) throws Exception {
final T value = element.getValue();
final long newTimestamp = userFunction.extractTimestamp(value,
element.hasTimestamp() ? element.getTimestamp() : Long.MIN_VALUE);
output.collect(element.replace(element.getValue(), newTimestamp));
final Watermark nextWatermark = userFunction.checkAndGetNextWatermark(value, newTimestamp);
if (nextWatermark != null && nextWatermark.getTimestamp() > currentWatermark) {
currentWatermark = nextWatermark.getTimestamp();
output.emitWatermark(nextWatermark);
}
}
代码示例来源:origin: apache/flink
@Override
public void processElement(StreamRecord<Tuple2<Long, Long>> element) throws Exception {
ValueState<Long> state = getKeyedStateBackend().getPartitionedState(
element.getValue().f0,
LongSerializer.INSTANCE,
stateDescriptor);
assertEquals(state.value(), element.getValue().f1);
getRuntimeContext().getAccumulator(SUCCESSFUL_PROCESS_CHECK_ACCUMULATOR).add(1);
output.collect(element);
}
代码示例来源:origin: apache/flink
@Override
public void processElement(StreamRecord<Tuple2<Long, Long>> element) throws Exception {
ValueState<Long> state = getKeyedStateBackend().getPartitionedState(
element.getValue().f0,
LongSerializer.INSTANCE,
stateDescriptor);
assertEquals(state.value(), element.getValue().f1);
getRuntimeContext().getAccumulator(SUCCESSFUL_PROCESS_CHECK_ACCUMULATOR).add(1);
output.collect(element);
}
内容来源于网络,如有侵权,请联系作者删除!