本文整理汇总了Java中org.apache.flink.streaming.runtime.streamrecord.StreamRecord.getTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Java StreamRecord.getTimestamp方法的具体用法?Java StreamRecord.getTimestamp怎么用?Java StreamRecord.getTimestamp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.flink.streaming.runtime.streamrecord.StreamRecord
的用法示例。
在下文中一共展示了StreamRecord.getTimestamp方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: compare
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public int compare(Object o1, Object o2) {
if (o1 instanceof Watermark || o2 instanceof Watermark) {
return 0;
} else {
StreamRecord<Tuple2<String, Integer>> sr0 = (StreamRecord<Tuple2<String, Integer>>) o1;
StreamRecord<Tuple2<String, Integer>> sr1 = (StreamRecord<Tuple2<String, Integer>>) o2;
if (sr0.getTimestamp() != sr1.getTimestamp()) {
return (int) (sr0.getTimestamp() - sr1.getTimestamp());
}
int comparison = sr0.getValue().f0.compareTo(sr1.getValue().f0);
if (comparison != 0) {
return comparison;
} else {
return sr0.getValue().f1 - sr1.getValue().f1;
}
}
}
示例3: compare
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public int compare(Object o1, Object o2) {
if (o1 instanceof Watermark || o2 instanceof Watermark) {
return 0;
} else {
StreamRecord<Tuple3<String, Long, Long>> sr0 = (StreamRecord<Tuple3<String, Long, Long>>) o1;
StreamRecord<Tuple3<String, Long, Long>> sr1 = (StreamRecord<Tuple3<String, Long, Long>>) o2;
if (sr0.getTimestamp() != sr1.getTimestamp()) {
return (int) (sr0.getTimestamp() - sr1.getTimestamp());
}
int comparison = sr0.getValue().f0.compareTo(sr1.getValue().f0);
if (comparison != 0) {
return comparison;
} else {
comparison = (int) (sr0.getValue().f1 - sr1.getValue().f1);
if (comparison != 0) {
return comparison;
}
return (int) (sr0.getValue().f2 - sr1.getValue().f2);
}
}
}
示例4: compare
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public int compare(Object o1, Object o2) {
if (o1 instanceof Watermark || o2 instanceof Watermark) {
return 0;
} else {
StreamRecord<Integer> sr0 = (StreamRecord<Integer>) o1;
StreamRecord<Integer> sr1 = (StreamRecord<Integer>) o2;
if (sr0.getTimestamp() != sr1.getTimestamp()) {
return (int) (sr0.getTimestamp() - sr1.getTimestamp());
}
int comparison = sr0.getValue().compareTo(sr1.getValue());
if (comparison != 0) {
return comparison;
} else {
return sr0.getValue() - sr1.getValue();
}
}
}
示例5: processElement
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public void processElement(StreamRecord<Long> element) throws Exception {
elCount++;
if(element.getValue() * 2 != element.getTimestamp()) {
throw new RuntimeException("Invalid timestamp: " + element);
}
}
示例6: compare
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public int compare(StreamRecord<IN> o1, StreamRecord<IN> o2) {
if (o1.getTimestamp() < o2.getTimestamp()) {
return -1;
} else if (o1.getTimestamp() > o2.getTimestamp()) {
return 1;
} else {
return 0;
}
}
示例7: processWatermark
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public void processWatermark(Watermark mark) throws Exception {
while (!priorityQueue.isEmpty() && priorityQueue.peek().getTimestamp() <= mark.getTimestamp()) {
StreamRecord<IN> streamRecord = priorityQueue.poll();
String streamId = getStreamId(streamRecord.getValue());
long timestamp = streamRecord.getTimestamp();
StreamSchema<IN> schema = siddhiPlan.getInputStreamSchema(streamId);
processEvent(streamId, schema, streamRecord.getValue(), timestamp);
}
output.emitWatermark(mark);
}
示例8: processElement
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public void processElement(StreamRecord<Long> element) throws Exception {
elCount++;
if (element.getValue() * 2 != element.getTimestamp()) {
throw new RuntimeException("Invalid timestamp: " + element);
}
}
示例9: processElement
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public void processElement(StreamRecord<Integer> element) throws Exception {
if (timestampsEnabled) {
if (element.getTimestamp() != element.getValue()) {
Assert.fail("Timestamps are not properly handled.");
}
}
output.collect(element);
}
示例10: compare
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public int compare(StreamRecord<IN> o1, StreamRecord<IN> o2) {
if (o1.getTimestamp() < o2.getTimestamp()) {
return -1;
} else if (o1.getTimestamp() > o2.getTimestamp()) {
return 1;
} else {
return 0;
}
}
示例11: 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<>();
}
示例12: 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());
}
}
示例13: collect
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
@Override
public void collect(StreamRecord<T> record) {
elements.add(record.getValue());
if (timeStampModulus != 0 && record.getTimestamp() % timeStampModulus != 0) {
throw new IllegalArgumentException("Invalid timestamp");
}
synchronized (elements) {
elements.notifyAll();
}
}
示例14: isElementLate
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord; //导入方法依赖的package包/类
/**
* Decide if a record is currently late, based on current watermark and allowed lateness.
*
* @param element The element to check
* @return The element for which should be considered when sideoutputs
*/
protected boolean isElementLate(StreamRecord<IN> element){
return (windowAssigner.isEventTime()) &&
(element.getTimestamp() + allowedLateness <= internalTimerService.currentWatermark());
}