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


Java TimestampedValue类代码示例

本文整理汇总了Java中org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue的典型用法代码示例。如果您正苦于以下问题:Java TimestampedValue类的具体用法?Java TimestampedValue怎么用?Java TimestampedValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TimestampedValue类属于org.apache.flink.streaming.runtime.operators.windowing包,在下文中一共展示了TimestampedValue类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evict

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
private void evict(Iterable<TimestampedValue<Object>> elements, int size, EvictorContext ctx) {
	if (size <= maxCount) {
		return;
	} else {
		int evictedCount = 0;
		for (Iterator<TimestampedValue<Object>> iterator = elements.iterator(); iterator.hasNext();){
			iterator.next();
			evictedCount++;
			if (evictedCount > size - maxCount) {
				break;
			} else {
				iterator.remove();
			}
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:17,代码来源:CountEvictor.java

示例2: evict

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
private void evict(Iterable<TimestampedValue<Object>> elements, int size, EvictorContext ctx) {
	if (!hasTimestamp(elements)) {
		return;
	}

	long currentTime = getMaxTimestamp(elements);
	long evictCutoff = currentTime - windowSize;

	for (Iterator<TimestampedValue<Object>> iterator = elements.iterator(); iterator.hasNext(); ) {
		TimestampedValue<Object> record = iterator.next();
		if (record.getTimestamp() <= evictCutoff) {
			iterator.remove();
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:16,代码来源:TimeEvictor.java

示例3: hasTimestamp

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
/**
 * Returns true if the first element in the Iterable of {@link TimestampedValue} has a timestamp.
    */
private boolean hasTimestamp(Iterable<TimestampedValue<Object>> elements) {
	Iterator<TimestampedValue<Object>> it = elements.iterator();
	if (it.hasNext()) {
		return it.next().hasTimestamp();
	}
	return false;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:11,代码来源:TimeEvictor.java

示例4: getMaxTimestamp

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
/**
 * @param elements The elements currently in the pane.
 * @return The maximum value of timestamp among the elements.
    */
private long getMaxTimestamp(Iterable<TimestampedValue<Object>> elements) {
	long currentTime = Long.MIN_VALUE;
	for (Iterator<TimestampedValue<Object>> iterator = elements.iterator(); iterator.hasNext();){
		TimestampedValue<Object> record = iterator.next();
		currentTime = Math.max(currentTime, record.getTimestamp());
	}
	return currentTime;
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:13,代码来源:TimeEvictor.java

示例5: evict

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
private void evict(Iterable<TimestampedValue<T>> elements, int size, EvictorContext ctx) {
	TimestampedValue<T> lastElement = Iterables.getLast(elements);
	for (Iterator<TimestampedValue<T>> iterator = elements.iterator(); iterator.hasNext();){
		TimestampedValue<T> element = iterator.next();
		if (deltaFunction.getDelta(element.getValue(), lastElement.getValue()) >= this.threshold) {
			iterator.remove();
		}
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:DeltaEvictor.java

示例6: evictAfter

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
@Override
public void evictAfter(Iterable<TimestampedValue<ConnectedCarEvent>> elements, int size, GlobalWindow window, EvictorContext ctx) {
	long firstStop = ConnectedCarEvent.earliestStopElement(elements);

	// remove all events up to (and including) the first stop event (which is the event that triggered the window)
	for (Iterator<TimestampedValue<ConnectedCarEvent>> iterator = elements.iterator(); iterator.hasNext(); ) {
		TimestampedValue<ConnectedCarEvent> element = iterator.next();
		if (element.getTimestamp() <= firstStop) {
			iterator.remove();
		}
	}
}
 
开发者ID:dataArtisans,项目名称:flink-training-exercises,代码行数:13,代码来源:DrivingSegments.java

示例7: earliestStopElement

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
public static Long earliestStopElement(Iterable<TimestampedValue<ConnectedCarEvent>> elements) {
	long earliestTime = Long.MAX_VALUE;

	for (Iterator<TimestampedValue<ConnectedCarEvent>> iterator = elements.iterator(); iterator.hasNext(); ) {
		TimestampedValue<ConnectedCarEvent> element = iterator.next();
		if (element.getTimestamp() < earliestTime && element.getValue().speed == 0.0) {
			earliestTime = element.getTimestamp();
		}
	}

	return earliestTime;
}
 
开发者ID:dataArtisans,项目名称:flink-training-exercises,代码行数:13,代码来源:ConnectedCarEvent.java

示例8: evictBefore

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
@Override
public void evictBefore(Iterable<TimestampedValue<Object>> elements, int size, W window, EvictorContext ctx) {
	if (!doEvictAfter) {
		evict(elements, size, ctx);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:7,代码来源:TimeEvictor.java

示例9: evictAfter

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
@Override
public void evictAfter(Iterable<TimestampedValue<Object>> elements, int size, W window, EvictorContext ctx) {
	if (doEvictAfter) {
		evict(elements, size, ctx);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:7,代码来源:TimeEvictor.java

示例10: evictBefore

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
@Override
public void evictBefore(Iterable<TimestampedValue<T>> elements, int size, W window, EvictorContext ctx) {
	if (!doEvictAfter) {
		evict(elements, size, ctx);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:7,代码来源:DeltaEvictor.java

示例11: evictAfter

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
@Override
public void evictAfter(Iterable<TimestampedValue<T>> elements, int size, W window, EvictorContext ctx) {
	if (doEvictAfter) {
		evict(elements, size, ctx);
	}
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:7,代码来源:DeltaEvictor.java

示例12: evictBefore

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
@Override
public void evictBefore(Iterable<TimestampedValue<ConnectedCarEvent>> events,
						int size, GlobalWindow window, EvictorContext ctx) {
}
 
开发者ID:dataArtisans,项目名称:flink-training-exercises,代码行数:5,代码来源:DrivingSegments.java

示例13: evictBefore

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
/**
 * Optionally evicts elements. Called before windowing function.
 *
 * @param elements The elements currently in the pane.
 * @param size The current number of elements in the pane.
 * @param window The {@link Window}
 * @param evictorContext The context for the Evictor
    */
void evictBefore(Iterable<TimestampedValue<T>> elements, int size, W window, EvictorContext evictorContext);
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:Evictor.java

示例14: evictAfter

import org.apache.flink.streaming.runtime.operators.windowing.TimestampedValue; //导入依赖的package包/类
/**
 * Optionally evicts elements. Called after windowing function.
 *
 * @param elements The elements currently in the pane.
 * @param size The current number of elements in the pane.
 * @param window The {@link Window}
 * @param evictorContext The context for the Evictor
 */
void evictAfter(Iterable<TimestampedValue<T>> elements, int size, W window, EvictorContext evictorContext);
 
开发者ID:axbaretto,项目名称:flink,代码行数:10,代码来源:Evictor.java


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