use of com.hazelcast.sql.impl.row.JetSqlRow in project hazelcast by hazelcast.
the class CreateDagVisitor method onProject.
public Vertex onProject(ProjectPhysicalRel rel) {
List<Expression<?>> projection = rel.projection(parameterMetadata);
Vertex vertex = dag.newUniqueVertex("Project", mapUsingServiceP(ServiceFactories.nonSharedService(ctx -> ExpressionUtil.projectionFn(projection, ExpressionEvalContext.from(ctx))), (Function<JetSqlRow, JetSqlRow> projectionFn, JetSqlRow row) -> projectionFn.apply(row)));
connectInputPreserveCollation(rel, vertex);
return vertex;
}
use of com.hazelcast.sql.impl.row.JetSqlRow in project hazelcast by hazelcast.
the class CreateDagVisitor method onAccumulate.
public Vertex onAccumulate(AggregateAccumulatePhysicalRel rel) {
AggregateOperation<?, JetSqlRow> aggregateOperation = rel.aggrOp();
Vertex vertex = dag.newUniqueVertex("Accumulate", Processors.accumulateP(aggregateOperation));
connectInput(rel.getInput(), vertex, null);
return vertex;
}
use of com.hazelcast.sql.impl.row.JetSqlRow in project hazelcast by hazelcast.
the class CreateDagVisitor method onCombineByKey.
public Vertex onCombineByKey(AggregateCombineByKeyPhysicalRel rel) {
AggregateOperation<?, JetSqlRow> aggregateOperation = rel.aggrOp();
Vertex vertex = dag.newUniqueVertex("CombineByKey", Processors.combineByKeyP(aggregateOperation, (key, value) -> value));
connectInput(rel.getInput(), vertex, edge -> edge.distributed().partitioned(entryKey()));
return vertex;
}
use of com.hazelcast.sql.impl.row.JetSqlRow in project hazelcast by hazelcast.
the class CreateDagVisitor method onAggregateByKey.
public Vertex onAggregateByKey(AggregateByKeyPhysicalRel rel) {
FunctionEx<JetSqlRow, ?> groupKeyFn = rel.groupKeyFn();
AggregateOperation<?, JetSqlRow> aggregateOperation = rel.aggrOp();
Vertex vertex = dag.newUniqueVertex("AggregateByKey", Processors.aggregateByKeyP(singletonList(groupKeyFn), aggregateOperation, (key, value) -> value));
connectInput(rel.getInput(), vertex, edge -> edge.distributed().partitioned(groupKeyFn));
return vertex;
}
use of com.hazelcast.sql.impl.row.JetSqlRow in project hazelcast by hazelcast.
the class CreateDagVisitor method onSlidingWindow.
public Vertex onSlidingWindow(SlidingWindowPhysicalRel rel) {
int orderingFieldIndex = rel.orderingFieldIndex();
FunctionEx<ExpressionEvalContext, SlidingWindowPolicy> windowPolicySupplier = rel.windowPolicyProvider();
// this vertex is used only if there's no aggregation by a window bound
Vertex vertex = dag.newUniqueVertex("Sliding-Window", flatMapUsingServiceP(ServiceFactories.nonSharedService(ctx -> {
ExpressionEvalContext evalContext = ExpressionEvalContext.from(ctx);
SlidingWindowPolicy windowPolicy = windowPolicySupplier.apply(evalContext);
return row -> WindowUtils.addWindowBounds(row, orderingFieldIndex, windowPolicy);
}), (BiFunctionEx<Function<JetSqlRow, Traverser<JetSqlRow>>, JetSqlRow, Traverser<JetSqlRow>>) Function::apply));
connectInput(rel.getInput(), vertex, null);
return vertex;
}
Aggregations