當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。