当前位置: 首页>>代码示例>>Java>>正文


Java StreamRecord.hasTimestamp方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:pravega,项目名称:flink-connectors,代码行数:21,代码来源:EventTimeOrderingOperator.java

示例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();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:22,代码来源:MultiplexingStreamRecordSerializer.java

示例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())));
	}

}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:AbstractStreamOperatorTestHarness.java

示例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);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:TimestampITCase.java

示例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();
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:8,代码来源:TimestampedSideOutputCollector.java

示例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<>();
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:9,代码来源:StreamRecordQueueEntry.java

示例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());
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:TimestampedValue.java


注:本文中的org.apache.flink.streaming.runtime.streamrecord.StreamRecord.hasTimestamp方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。