Search in sources :

Example 1 with AsyncTransformUsingServiceOrderedP

use of com.hazelcast.jet.impl.processor.AsyncTransformUsingServiceOrderedP in project hazelcast by hazelcast.

the class JoinByPrimitiveKeyProcessorSupplier method get.

@Nonnull
@Override
public Collection<? extends Processor> get(int count) {
    List<Processor> processors = new ArrayList<>(count);
    for (int i = 0; i < count; i++) {
        String mapName = this.mapName;
        KvRowProjector projector = rightRowProjectorSupplier.get(evalContext, extractors);
        Processor processor = new AsyncTransformUsingServiceOrderedP<>(ServiceFactories.nonSharedService(SecuredFunctions.iMapFn(mapName)), null, MAX_CONCURRENT_OPS, (IMap<Object, Object> map, JetSqlRow left) -> {
            Object key = left.get(leftEquiJoinIndex);
            if (key == null) {
                return inner ? null : completedFuture(null);
            }
            return map.getAsync(key).toCompletableFuture();
        }, (left, value) -> {
            JetSqlRow joined = join(left, left.get(leftEquiJoinIndex), value, projector, condition, evalContext);
            return joined != null ? singleton(joined) : inner ? null : singleton(left.extendedRow(projector.getColumnCount()));
        });
        processors.add(processor);
    }
    return processors;
}
Also used : IMap(com.hazelcast.map.IMap) KvRowProjector(com.hazelcast.jet.sql.impl.connector.keyvalue.KvRowProjector) Processor(com.hazelcast.jet.core.Processor) AsyncTransformUsingServiceOrderedP(com.hazelcast.jet.impl.processor.AsyncTransformUsingServiceOrderedP) ArrayList(java.util.ArrayList) JetSqlRow(com.hazelcast.sql.impl.row.JetSqlRow) Nonnull(javax.annotation.Nonnull)

Aggregations

Processor (com.hazelcast.jet.core.Processor)1 AsyncTransformUsingServiceOrderedP (com.hazelcast.jet.impl.processor.AsyncTransformUsingServiceOrderedP)1 KvRowProjector (com.hazelcast.jet.sql.impl.connector.keyvalue.KvRowProjector)1 IMap (com.hazelcast.map.IMap)1 JetSqlRow (com.hazelcast.sql.impl.row.JetSqlRow)1 ArrayList (java.util.ArrayList)1 Nonnull (javax.annotation.Nonnull)1