use of com.hazelcast.jet.impl.JetEvent in project hazelcast by hazelcast.
the class WindowAggregateTransform method addSessionWindow.
// --------- ---------
// | source0 | ... | sourceN |
// --------- ---------
// | |
// distributed distributed
// all-to-one all-to-one
// \ /
// ---\ /-----
// v v
// ---------------------------
// | aggregateToSessionWindowP | local parallelism = 1
// ---------------------------
private void addSessionWindow(Planner p, SessionWindowDefinition wDef) {
determinedLocalParallelism(1);
PlannerVertex pv = p.addVertex(this, name(), determinedLocalParallelism(), aggregateToSessionWindowP(wDef.sessionTimeout(), wDef.earlyResultsPeriod(), nCopies(aggrOp.arity(), (ToLongFunctionEx<JetEvent<?>>) JetEvent::timestamp), nCopies(aggrOp.arity(), new ConstantFunctionEx<>(name().hashCode())), aggrOp, jetEventOfWindowResultFn()));
p.addEdges(this, pv.v, edge -> edge.distributed().allToOne(name().hashCode()));
}
use of com.hazelcast.jet.impl.JetEvent in project hazelcast by hazelcast.
the class WindowAggregateTransform method addSlidingWindowSingleStage.
// --------- ---------
// | source0 | ... | sourceN |
// --------- ---------
// | |
// distributed distributed
// all-to-one all-to-one
// \ /
// ---\ /-----
// v v
// ---------------------------
// | aggregateToSlidingWindowP | local parallelism = 1
// ---------------------------
private void addSlidingWindowSingleStage(Planner p, SlidingWindowDefinition wDef) {
determinedLocalParallelism(1);
PlannerVertex pv = p.addVertex(this, name(), determinedLocalParallelism(), aggregateToSlidingWindowP(nCopies(aggrOp.arity(), new ConstantFunctionEx<>(name().hashCode())), nCopies(aggrOp.arity(), (ToLongFunctionEx<JetEvent<?>>) JetEvent::timestamp), TimestampKind.EVENT, slidingWinPolicy(wDef.windowSize(), wDef.slideBy()), wDef.earlyResultsPeriod(), aggrOp, jetEventOfWindowResultFn()));
p.addEdges(this, pv.v, edge -> edge.distributed().allToOne(name().hashCode()));
}
use of com.hazelcast.jet.impl.JetEvent in project hazelcast by hazelcast.
the class WindowGroupTransform method addSessionWindow.
// --------- ---------
// | source0 | ... | sourceN |
// --------- ---------
// | |
// distributed distributed
// partitioned partitioned
// \ /
// ---\ /-----
// v v
// ---------------------------
// | aggregateToSessionWindowP |
// ---------------------------
private void addSessionWindow(Planner p, SessionWindowDefinition wDef) {
PlannerVertex pv = p.addVertex(this, name(), determinedLocalParallelism(), aggregateToSessionWindowP(wDef.sessionTimeout(), wDef.earlyResultsPeriod(), nCopies(keyFns.size(), (ToLongFunctionEx<JetEvent<?>>) JetEvent::timestamp), keyFns, aggrOp, jetEventOfKeyedWindowResultFn()));
p.addEdges(this, pv.v, (e, ord) -> e.distributed().partitioned(keyFns.get(ord)));
}
use of com.hazelcast.jet.impl.JetEvent in project hazelcast by hazelcast.
the class WindowGroupTransform method addSlidingWindowSingleStage.
// --------- ---------
// | source0 | ... | sourceN |
// --------- ---------
// | |
// distributed distributed
// partitioned partitioned
// \ /
// ---\ /-----
// v v
// ---------------------------
// | aggregateToSlidingWindowP |
// ---------------------------
private void addSlidingWindowSingleStage(Planner p, SlidingWindowDefinition wDef) {
PlannerVertex pv = p.addVertex(this, name(), determinedLocalParallelism(), aggregateToSlidingWindowP(keyFns, nCopies(keyFns.size(), (ToLongFunctionEx<JetEvent<?>>) JetEvent::timestamp), TimestampKind.EVENT, slidingWinPolicy(wDef.windowSize(), wDef.slideBy()), wDef.earlyResultsPeriod(), aggrOp, jetEventOfKeyedWindowResultFn()));
p.addEdges(this, pv.v, (e, ord) -> e.distributed().partitioned(keyFns.get(ord)));
}
use of com.hazelcast.jet.impl.JetEvent in project hazelcast by hazelcast.
the class WindowAggregateTransform method addSlidingWindowTwoStage.
// WHEN PRESERVE ORDER IS NOT ACTIVE
// -------- ---------
// | source0 | ... | sourceN |
// -------- ---------
// | |
// local local
// unicast unicast
// v v
// --------------------
// | accumulateByFrameP | keyFn = constantKey()
// --------------------
// |
// distributed
// all-to-one
// v
// -------------------------
// | combineToSlidingWindowP | local parallelism = 1
// -------------------------
// WHEN PRESERVE ORDER IS ACTIVE
// -------- ---------
// | source0 | ... | sourceN |
// -------- ---------
// | |
// isolated isolated
// v v
// --------------------
// | accumulateByFrameP | keyFn = constantKey()
// --------------------
// |
// distributed
// all-to-one
// v
// -------------------------
// | combineToSlidingWindowP | local parallelism = 1
// -------------------------
private void addSlidingWindowTwoStage(Planner p, SlidingWindowDefinition wDef, Context context) {
determineLocalParallelism(LOCAL_PARALLELISM_USE_DEFAULT, context, p.isPreserveOrder());
SlidingWindowPolicy winPolicy = slidingWinPolicy(wDef.windowSize(), wDef.slideBy());
Vertex v1 = p.dag.newVertex(name() + FIRST_STAGE_VERTEX_NAME_SUFFIX, accumulateByFrameP(nCopies(aggrOp.arity(), new ConstantFunctionEx<>(name().hashCode())), nCopies(aggrOp.arity(), (ToLongFunctionEx<JetEvent<?>>) JetEvent::timestamp), TimestampKind.EVENT, winPolicy, aggrOp));
v1.localParallelism(determinedLocalParallelism());
if (p.isPreserveOrder()) {
p.addEdges(this, v1, Edge::isolated);
} else {
// when preserveOrder is false, we use requested parallelism
// for 1st stage: edge to it is local-unicast, each processor
// can process part of the input which will be combined into
// one result in 2nd stage.
p.addEdges(this, v1);
}
determinedLocalParallelism(1);
PlannerVertex pv2 = p.addVertex(this, name(), determinedLocalParallelism(), combineToSlidingWindowP(winPolicy, aggrOp, jetEventOfWindowResultFn()));
p.dag.edge(between(v1, pv2.v).distributed().allToOne(name().hashCode()));
}
Aggregations