本文整理汇总了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();
}
}
}
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例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();
}
}
}
示例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();
}
}
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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) {
}
示例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);
示例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);