use of com.hazelcast.sql.impl.row.JetSqlRow in project hazelcast by hazelcast.
the class CreateDagVisitor method onAccumulateByKey.
public Vertex onAccumulateByKey(AggregateAccumulateByKeyPhysicalRel rel) {
FunctionEx<JetSqlRow, ?> groupKeyFn = rel.groupKeyFn();
AggregateOperation<?, JetSqlRow> aggregateOperation = rel.aggrOp();
Vertex vertex = dag.newUniqueVertex("AccumulateByKey", Processors.accumulateByKeyP(singletonList(groupKeyFn), aggregateOperation));
connectInput(rel.getInput(), vertex, edge -> edge.partitioned(groupKeyFn));
return vertex;
}
use of com.hazelcast.sql.impl.row.JetSqlRow in project hazelcast by hazelcast.
the class CreateDagVisitor method onAggregate.
public Vertex onAggregate(AggregatePhysicalRel rel) {
AggregateOperation<?, JetSqlRow> aggregateOperation = rel.aggrOp();
Vertex vertex = dag.newUniqueVertex("Aggregate", ProcessorMetaSupplier.forceTotalParallelismOne(ProcessorSupplier.of(Processors.aggregateP(aggregateOperation)), localMemberAddress));
connectInput(rel.getInput(), vertex, edge -> edge.distributeTo(localMemberAddress).allToOne(""));
return vertex;
}
use of com.hazelcast.sql.impl.row.JetSqlRow in project hazelcast by hazelcast.
the class ProjectorTest method test_project.
@Test
public void test_project() {
Projector projector = new Projector(new QueryPath[] { QueryPath.create("this.field") }, new QueryDataType[] { QueryDataType.BIGINT }, new MultiplyingTarget(), singletonList(CastExpression.create(ColumnExpression.create(0, QueryDataType.INT), QueryDataType.BIGINT)), mock(ExpressionEvalContext.class));
Object value = projector.project(new JetSqlRow(TEST_SS, new Object[] { 1 }));
assertThat(value).isEqualTo(2L);
}
use of com.hazelcast.sql.impl.row.JetSqlRow in project hazelcast by hazelcast.
the class KvRowProjectorTest method test_project_onlyDataKeyAndValueIsProvided.
@Test
public void test_project_onlyDataKeyAndValueIsProvided() {
InternalSerializationService serializationService = new DefaultSerializationServiceBuilder().build();
KvRowProjector projector = new KvRowProjector(new QueryPath[] { QueryPath.KEY_PATH, QueryPath.VALUE_PATH }, new QueryDataType[] { INT, INT }, new GenericQueryTarget(serializationService, null, true), new GenericQueryTarget(serializationService, null, false), null, asList(MultiplyFunction.create(ColumnExpression.create(0, INT), ConstantExpression.create(2, INT), INT), DivideFunction.create(ColumnExpression.create(1, INT), ConstantExpression.create(2, INT), INT)), SqlTestSupport.createExpressionEvalContext());
JetSqlRow row = projector.project(serializationService.toData(1), serializationService.toData(8));
assertThat(row).isEqualTo(jetRow(2, 4));
}
use of com.hazelcast.sql.impl.row.JetSqlRow in project hazelcast by hazelcast.
the class RowProjectorTest method when_filteredByPredicate_then_returnsNull.
@Test
@SuppressWarnings("unchecked")
public void when_filteredByPredicate_then_returnsNull() {
RowProjector projector = new RowProjector(new String[] { "target" }, new QueryDataType[] { INT }, new IdentityTarget(), (Expression<Boolean>) ConstantExpression.create(Boolean.FALSE, BOOLEAN), emptyList(), mock(ExpressionEvalContext.class));
JetSqlRow row = projector.project(1);
assertThat(row).isNull();
}
Aggregations