use of com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex in project hazelcast by hazelcast.
the class MapTransform method addToDag.
@Override
public void addToDag(Planner p, Context context) {
determineLocalParallelism(LOCAL_PARALLELISM_USE_DEFAULT, context, p.isPreserveOrder());
PlannerVertex pv = p.addVertex(this, name(), determinedLocalParallelism(), mapP(mapFn()));
if (p.isPreserveOrder()) {
p.addEdges(this, pv.v, Edge::isolated);
} else {
p.addEdges(this, pv.v);
}
}
use of com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex in project hazelcast by hazelcast.
the class GroupTransform method addToDagTwoStage.
// --------- ---------
// | source0 | ... | sourceN |
// --------- ---------
// | |
// local local
// partitioned partitioned
// v v
// --------------------
// | accumulateByKeyP |
// --------------------
// |
// distributed
// partitioned
// v
// ---------------
// | combineByKeyP |
// ---------------
private void addToDagTwoStage(Planner p) {
List<FunctionEx<?, ? extends K>> groupKeyFns = this.groupKeyFns;
Vertex v1 = p.dag.newVertex(name() + FIRST_STAGE_VERTEX_NAME_SUFFIX, accumulateByKeyP(groupKeyFns, aggrOp)).localParallelism(determinedLocalParallelism());
PlannerVertex pv2 = p.addVertex(this, name(), determinedLocalParallelism(), combineByKeyP(aggrOp, mapToOutputFn));
p.addEdges(this, v1, (e, ord) -> e.partitioned(groupKeyFns.get(ord), HASH_CODE));
p.dag.edge(between(v1, pv2.v).distributed().partitioned(entryKey()));
}
use of com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex in project hazelcast by hazelcast.
the class MergeTransform method addToDag.
@Override
public void addToDag(Planner p, Context context) {
determineLocalParallelism(LOCAL_PARALLELISM_USE_DEFAULT, context, p.isPreserveOrder());
PlannerVertex pv = p.addVertex(this, name(), determinedLocalParallelism(), mapP(identity()));
if (p.isPreserveOrder()) {
p.addEdges(this, pv.v, Edge::isolated);
} else {
p.addEdges(this, pv.v);
}
}
use of com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex in project hazelcast by hazelcast.
the class PeekTransform method addToDag.
@Override
public void addToDag(Planner p, Context context) {
determineLocalParallelism(LOCAL_PARALLELISM_USE_DEFAULT, context, p.isPreserveOrder());
PlannerVertex peekedPv = p.xform2vertex.get(this.upstream().get(0));
// Peeking transform doesn't add a vertex, so point to the upstream
// transform's vertex:
p.xform2vertex.put(this, peekedPv);
peekedPv.v.updateMetaSupplier(sup -> peekOutputP(toStringFn, shouldLogFn, sup));
}
use of com.hazelcast.jet.impl.pipeline.Planner.PlannerVertex in project hazelcast by hazelcast.
the class SinkTransform method addToDag.
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
public void addToDag(Planner p, Context context) {
determineLocalParallelism(sink.metaSupplier().preferredLocalParallelism(), context, false);
PlannerVertex pv = p.addVertex(this, name(), determinedLocalParallelism(), adaptingMetaSupplier(sink.metaSupplier(), ordinalsToAdapt));
p.addEdges(this, pv.v, (e, ord) -> {
// all the items will be routed to the member with the partition key
if (sink.getType() == TOTAL_PARALLELISM_ONE) {
e.allToOne(sink.name()).distributed();
} else {
if (sink.getType().isPartitioned()) {
FunctionEx keyFn = sink.partitionKeyFunction();
if (arrayIndexOf(ord, ordinalsToAdapt) >= 0) {
keyFn = ADAPT_TO_JET_EVENT.adaptKeyFn(keyFn);
}
e.partitioned(keyFn, Partitioner.defaultPartitioner());
}
if (sink.getType().isDistributed()) {
e.distributed();
}
}
});
}
Aggregations