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


Java StreamRecord.getTimestamp方法代码示例

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

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

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

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

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

示例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;
    }
}
 
开发者ID:apache,项目名称:bahir-flink,代码行数:11,代码来源:StreamRecordComparator.java

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

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

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

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

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

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

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

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


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