本文整理汇总了Java中org.apache.flink.streaming.runtime.streamrecord.StreamRecord.hasTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Java StreamRecord.hasTimestamp方法的具体用法?Java StreamRecord.hasTimestamp怎么用?Java StreamRecord.hasTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.streaming.runtime.streamrecord.StreamRecord
的用法示例。
在下文中一共展示了StreamRecord.hasTimestamp方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processElement
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public void processElement(StreamRecord<T> element) throws Exception {
if (!element.hasTimestamp()) {
// elements with no time component are simply forwarded.
// likely cause: the time characteristic of the program is not event-time.
output.collect(element);
return;
}
// In event-time processing we assume correctness of the watermark.
// Events with timestamp smaller than (or equal to) the last seen watermark are considered late.
// FUTURE: emit late elements to a side output
if (element.getTimestamp() > lastWatermark) {
// we have an event with a valid timestamp, so
// we buffer it until we receive the proper watermark.
saveRegisterWatermarkTimer();
bufferEvent(element);
}
}
示例2: serialize
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public void serialize(StreamElement value, DataOutputView target) throws IOException {
if (value.isRecord()) {
StreamRecord<T> record = value.asRecord();
if (record.hasTimestamp()) {
target.write(TAG_REC_WITH_TIMESTAMP);
target.writeLong(record.getTimestamp());
} else {
target.write(TAG_REC_WITHOUT_TIMESTAMP);
}
typeSerializer.serialize(record.getValue(), target);
}
else if (value.isWatermark()) {
target.write(TAG_WATERMARK);
target.writeLong(value.asWatermark().getTimestamp());
}
else {
throw new RuntimeException();
}
}
示例3: collect
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public <X> void collect(OutputTag<X> outputTag, StreamRecord<X> record) {
sideOutputSerializer = TypeExtractor.getForObject(record.getValue()).createSerializer(executionConfig);
ConcurrentLinkedQueue<Object> sideOutputList = sideOutputLists.get(outputTag);
if (sideOutputList == null) {
sideOutputList = new ConcurrentLinkedQueue<>();
sideOutputLists.put(outputTag, sideOutputList);
}
if (record.hasTimestamp()) {
sideOutputList.add(new StreamRecord<>(sideOutputSerializer.copy(record.getValue()), record.getTimestamp()));
} else {
sideOutputList.add(new StreamRecord<>(sideOutputSerializer.copy(record.getValue())));
}
}
示例4: processElement
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public void processElement(StreamRecord<Integer> element) throws Exception {
if (element.hasTimestamp()) {
Assert.fail("Timestamps are not properly handled.");
}
output.collect(element);
}
示例5: setTimestamp
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
public void setTimestamp(StreamRecord<?> timestampBase) {
if (timestampBase.hasTimestamp()) {
reuse.setTimestamp(timestampBase.getTimestamp());
} else {
reuse.eraseTimestamp();
}
}
示例6: StreamRecordQueueEntry
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
public StreamRecordQueueEntry(StreamRecord<?> streamRecord) {
super(streamRecord);
hasTimestamp = streamRecord.hasTimestamp();
timestamp = streamRecord.getTimestamp();
resultFuture = new CompletableFuture<>();
}
示例7: from
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
/**
* Creates a TimestampedValue from given {@link StreamRecord}.
*
* @param streamRecord The StreamRecord object from which TimestampedValue is to be created.
*/
public static <T> TimestampedValue<T> from(StreamRecord<T> streamRecord) {
if (streamRecord.hasTimestamp()) {
return new TimestampedValue<>(streamRecord.getValue(), streamRecord.getTimestamp());
} else {
return new TimestampedValue<>(streamRecord.getValue());
}
}