use of com.hazelcast.jet.sql.impl.inject.UpsertTargetDescriptor in project hazelcast by hazelcast.
the class SinkMapPhysicalRel method entriesFn.
public Function<ExpressionEvalContext, Map<Object, Object>> entriesFn() {
PartitionedMapTable table = table();
List<ExpressionValues> values = this.values;
return evalContext -> {
KvProjector projector = KvProjector.supplier(table.paths(), table.types(), (UpsertTargetDescriptor) table.getKeyJetMetadata(), (UpsertTargetDescriptor) table.getValueJetMetadata(), true).get(evalContext.getSerializationService());
return values.stream().flatMap(vs -> vs.toValues(evalContext)).map(projector::project).collect(toMap(Entry::getKey, Entry::getValue));
};
}
use of com.hazelcast.jet.sql.impl.inject.UpsertTargetDescriptor in project hazelcast by hazelcast.
the class InsertMapPhysicalRel method entriesFn.
public Function<ExpressionEvalContext, List<Entry<Object, Object>>> entriesFn() {
PartitionedMapTable table = table();
ExpressionValues values = this.values;
return evalContext -> {
KvProjector projector = KvProjector.supplier(table.paths(), table.types(), (UpsertTargetDescriptor) table.getKeyJetMetadata(), (UpsertTargetDescriptor) table.getValueJetMetadata(), true).get(evalContext.getSerializationService());
return values.toValues(evalContext).map(projector::project).collect(toList());
};
}
use of com.hazelcast.jet.sql.impl.inject.UpsertTargetDescriptor in project hazelcast by hazelcast.
the class IMapSqlConnector method insertProcessor.
@Nonnull
@Override
public VertexWithInputConfig insertProcessor(@Nonnull DAG dag, @Nonnull Table table0) {
PartitionedMapTable table = (PartitionedMapTable) table0;
Vertex vertex = dag.newUniqueVertex(toString(table), new InsertProcessorSupplier(table.getMapName(), KvProjector.supplier(table.paths(), table.types(), (UpsertTargetDescriptor) table.getKeyJetMetadata(), (UpsertTargetDescriptor) table.getValueJetMetadata(), true))).localParallelism(1);
return new VertexWithInputConfig(vertex, edge -> edge.distributed().allToOne(newUnsecureUuidString()));
}
use of com.hazelcast.jet.sql.impl.inject.UpsertTargetDescriptor in project hazelcast by hazelcast.
the class IMapSqlConnector method sinkProcessor.
@Nonnull
@Override
public Vertex sinkProcessor(@Nonnull DAG dag, @Nonnull Table table0) {
PartitionedMapTable table = (PartitionedMapTable) table0;
Vertex vStart = dag.newUniqueVertex("Project(" + toString(table) + ")", KvProcessors.entryProjector(table.paths(), table.types(), (UpsertTargetDescriptor) table.getKeyJetMetadata(), (UpsertTargetDescriptor) table.getValueJetMetadata(), true));
Vertex vEnd = dag.newUniqueVertex(toString(table), writeMapP(table.getMapName()));
dag.edge(between(vStart, vEnd));
return vStart;
}
Aggregations