Search in sources :

Example 1 with JetEvent

use of com.hazelcast.jet.impl.pipeline.JetEvent in project hazelcast-jet 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, SessionWindowDef wDef) {
    PlannerVertex pv = p.addVertex(this, p.uniqueVertexName(name(), ""), localParallelism(), aggregateToSessionWindowP(wDef.sessionTimeout(), nCopies(aggrOp.arity(), (DistributedToLongFunction<JetEvent>) JetEvent::timestamp), nCopies(aggrOp.arity(), constantKey()), aggrOp, mapToOutputFn.toKeyedWindowResultFn()));
    p.addEdges(this, pv.v, edge -> edge.distributed().allToOne());
}
Also used : PlannerVertex(com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex) JetEvent(com.hazelcast.jet.impl.pipeline.JetEvent)

Example 2 with JetEvent

use of com.hazelcast.jet.impl.pipeline.JetEvent in project hazelcast-jet by hazelcast.

the class WindowGroupTransform method addSlidingWindowSingleStage.

// ---------       ---------
// | source0 | ... | sourceN |
// ---------       ---------
// |              |
// distributed    distributed
// partitioned    partitioned
// \              /
// ---\    /-----
// v  v
// ---------------------------
// | aggregateToSlidingWindowP |
// ---------------------------
private void addSlidingWindowSingleStage(Planner p, SlidingWindowDef wDef) {
    PlannerVertex pv = p.addVertex(this, p.uniqueVertexName(name(), ""), localParallelism(), aggregateToSlidingWindowP(keyFns, nCopies(keyFns.size(), (DistributedToLongFunction<JetEvent>) JetEvent::timestamp), TimestampKind.EVENT, wDef.toSlidingWindowPolicy(), aggrOp, mapToOutputFn));
    p.addEdges(this, pv.v, (e, ord) -> e.distributed().partitioned(keyFns.get(ord)));
}
Also used : PlannerVertex(com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex) JetEvent(com.hazelcast.jet.impl.pipeline.JetEvent)

Example 3 with JetEvent

use of com.hazelcast.jet.impl.pipeline.JetEvent in project hazelcast-jet by hazelcast.

the class WindowGroupTransform method addSlidingWindowTwoStage.

// ---------       ---------
// | source0 | ... | sourceN |
// ---------       ---------
// |               |
// local           local
// partitioned     partitioned
// v               v
// --------------------
// | accumulateByFrameP |
// --------------------
// |
// distributed
// partitioned
// v
// -------------------------
// | combineToSlidingWindowP |
// -------------------------
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(keyFns, nCopies(keyFns.size(), (DistributedToLongFunction<JetEvent>) JetEvent::timestamp), TimestampKind.EVENT, winPolicy, aggrOp));
    v1.localParallelism(localParallelism());
    PlannerVertex pv2 = p.addVertex(this, namePrefix + '2', localParallelism(), combineToSlidingWindowP(winPolicy, aggrOp, mapToOutputFn));
    p.addEdges(this, v1, (e, ord) -> e.partitioned(keyFns.get(ord), HASH_CODE));
    p.dag.edge(between(v1, pv2.v).distributed().partitioned(entryKey()));
}
Also used : PlannerVertex(com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex) Vertex(com.hazelcast.jet.core.Vertex) PlannerVertex(com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex) SlidingWindowPolicy(com.hazelcast.jet.core.SlidingWindowPolicy) JetEvent(com.hazelcast.jet.impl.pipeline.JetEvent)

Example 4 with JetEvent

use of com.hazelcast.jet.impl.pipeline.JetEvent in project hazelcast-jet by hazelcast.

the class WindowGroupTransform method addSessionWindow.

// ---------       ---------
// | source0 | ... | sourceN |
// ---------       ---------
// |              |
// distributed    distributed
// partitioned    partitioned
// \              /
// ---\    /-----
// v  v
// ---------------------------
// | aggregateToSessionWindowP |
// ---------------------------
private void addSessionWindow(Planner p, SessionWindowDef wDef) {
    PlannerVertex pv = p.addVertex(this, p.uniqueVertexName(name(), ""), localParallelism(), aggregateToSessionWindowP(wDef.sessionTimeout(), nCopies(keyFns.size(), (DistributedToLongFunction<JetEvent>) JetEvent::timestamp), keyFns, aggrOp, mapToOutputFn));
    p.addEdges(this, pv.v, (e, ord) -> e.distributed().partitioned(keyFns.get(ord)));
}
Also used : PlannerVertex(com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex) JetEvent(com.hazelcast.jet.impl.pipeline.JetEvent)

Example 5 with JetEvent

use of com.hazelcast.jet.impl.pipeline.JetEvent in project hazelcast-jet 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, SlidingWindowDef wDef) {
    PlannerVertex pv = p.addVertex(this, p.uniqueVertexName(name(), ""), 1, aggregateToSlidingWindowP(nCopies(aggrOp.arity(), constantKey()), nCopies(aggrOp.arity(), (DistributedToLongFunction<JetEvent>) JetEvent::timestamp), TimestampKind.EVENT, wDef.toSlidingWindowPolicy(), aggrOp, mapToOutputFn.toKeyedWindowResultFn()));
    p.addEdges(this, pv.v, edge -> edge.distributed().allToOne());
}
Also used : PlannerVertex(com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex) JetEvent(com.hazelcast.jet.impl.pipeline.JetEvent)

Aggregations

JetEvent (com.hazelcast.jet.impl.pipeline.JetEvent)7 PlannerVertex (com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex)6 SlidingWindowPolicy (com.hazelcast.jet.core.SlidingWindowPolicy)2 Vertex (com.hazelcast.jet.core.Vertex)2 Watermark (com.hazelcast.jet.core.Watermark)1