use of com.apple.foundationdb.record.query.plan.plans.QueryResult in project fdb-record-layer by FoundationDB.
the class FDBStreamAggregateTest method aggregateTwoGroupByTwo.
@Test
public void aggregateTwoGroupByTwo() throws Exception {
try (FDBRecordContext context = openContext()) {
openSimpleRecordStore(context, NO_HOOK);
RecordQueryPlan plan = new AggregatePlanBuilder("MySimpleRecord").withAggregateValue("num_value_2", "SumInteger").withAggregateValue("num_value_2", "MinInteger").withGroupCriterion("num_value_3_indexed").withGroupCriterion("str_value_indexed").build();
List<QueryResult> result = executePlan(plan);
assertResults(result, resultOf(0, "0", 1, 0), resultOf(1, "0", 2, 2), resultOf(1, "1", 3, 3), resultOf(2, "1", 9, 4));
}
}
use of com.apple.foundationdb.record.query.plan.plans.QueryResult in project fdb-record-layer by FoundationDB.
the class FDBStreamAggregateTest method aggregateThreeGroupByTwo.
@Test
public void aggregateThreeGroupByTwo() throws Exception {
try (FDBRecordContext context = openContext()) {
openSimpleRecordStore(context, NO_HOOK);
RecordQueryPlan plan = new AggregatePlanBuilder("MySimpleRecord").withAggregateValue("num_value_2", "SumInteger").withAggregateValue("num_value_2", "MinInteger").withAggregateValue("num_value_2", "AvgInteger").withGroupCriterion("num_value_3_indexed").withGroupCriterion("str_value_indexed").build();
List<QueryResult> result = executePlan(plan);
assertResults(result, resultOf(0, "0", 1, 0, 0.5), resultOf(1, "0", 2, 2, 2.0), resultOf(1, "1", 3, 3, 3.0), resultOf(2, "1", 9, 4, 4.5));
}
}
use of com.apple.foundationdb.record.query.plan.plans.QueryResult in project fdb-record-layer by FoundationDB.
the class FDBStreamAggregateTest method noAggregateGroupByOne.
@Test
public void noAggregateGroupByOne() throws Exception {
try (FDBRecordContext context = openContext()) {
openSimpleRecordStore(context, NO_HOOK);
RecordQueryPlan plan = new AggregatePlanBuilder("MySimpleRecord").withGroupCriterion("num_value_3_indexed").build();
List<QueryResult> result = executePlan(plan);
assertResults(result, resultOf(0), resultOf(1), resultOf(2));
}
}
use of com.apple.foundationdb.record.query.plan.plans.QueryResult in project fdb-record-layer by FoundationDB.
the class FDBStreamAggregateTest method aggregateNoRecordsNoGroupNoAggregate.
@Test
public void aggregateNoRecordsNoGroupNoAggregate() throws Exception {
try (FDBRecordContext context = openContext()) {
openSimpleRecordStore(context, NO_HOOK);
RecordQueryPlan plan = new AggregatePlanBuilder("MyOtherRecord").build();
List<QueryResult> result = executePlan(plan);
Assertions.assertTrue(result.isEmpty());
}
}
use of com.apple.foundationdb.record.query.plan.plans.QueryResult in project fdb-record-layer by FoundationDB.
the class FDBStreamAggregateTest method noAggregateGroupByNone.
@Test
public void noAggregateGroupByNone() throws Exception {
try (FDBRecordContext context = openContext()) {
openSimpleRecordStore(context, NO_HOOK);
RecordQueryPlan plan = new AggregatePlanBuilder("MySimpleRecord").build();
List<QueryResult> result = executePlan(plan);
assertResults(result, resultOf());
}
}
Aggregations