use of com.hazelcast.jet.impl.pipeline.JetEvent in project hazelcast-jet by hazelcast.
the class WindowAggregateTransform method addSlidingWindowTwoStage.
// -------- ---------
// | source0 | ... | sourceN |
// -------- ---------
// | |
// local local
// unicast unicast
// v v
// --------------------
// | accumulateByFrameP | keyFn = constantKey()
// --------------------
// |
// distributed
// all-to-one
// v
// -------------------------
// | combineToSlidingWindowP | local parallelism = 1
// -------------------------
private void addSlidingWindowTwoStage(Planner p, SlidingWindowDef wDef) {
String namePrefix = p.uniqueVertexName(name(), "-step");
SlidingWindowPolicy winPolicy = wDef.toSlidingWindowPolicy();
Vertex v1 = p.dag.newVertex(namePrefix + '1', accumulateByFrameP(nCopies(aggrOp.arity(), constantKey()), nCopies(aggrOp.arity(), (DistributedToLongFunction<JetEvent>) JetEvent::timestamp), TimestampKind.EVENT, winPolicy, aggrOp));
v1.localParallelism(localParallelism());
PlannerVertex pv2 = p.addVertex(this, namePrefix + '2', 1, combineToSlidingWindowP(winPolicy, aggrOp, mapToOutputFn.toKeyedWindowResultFn()));
p.addEdges(this, v1);
p.dag.edge(between(v1, pv2.v).distributed().allToOne());
}
use of com.hazelcast.jet.impl.pipeline.JetEvent in project hazelcast-jet by hazelcast.
the class Util method logLateEvent.
public static void logLateEvent(ILogger logger, long currentWm, @Nonnull Object item) {
if (!logger.isInfoEnabled()) {
return;
}
if (item instanceof JetEvent) {
JetEvent event = (JetEvent) item;
logger.info(String.format("Event dropped, late by %dms. currentWatermark=%s, eventTime=%s, event=%s", currentWm - event.timestamp(), toLocalTime(currentWm), toLocalTime(event.timestamp()), event.payload()));
} else {
logger.info(String.format("Late event dropped. currentWatermark=%s, event=%s", new Watermark(currentWm), item));
}
}
Aggregations