use of com.yahoo.bullet.querying.aggregations.grouping.GroupOperation in project bullet-core by yahoo.
the class GroupAllTest method testToString.
@Test
public void testToString() {
GroupOperation operation = new GroupOperation(GroupOperation.GroupOperationType.SUM, "abc", "sum");
GroupAll aggregation = new GroupAll(Collections.singleton(operation));
Assert.assertEquals(aggregation.toString(), "{size: null, type: GROUP, operations: [{type: SUM, field: abc, name: sum}]}");
}
use of com.yahoo.bullet.querying.aggregations.grouping.GroupOperation in project bullet-core by yahoo.
the class GroupAllTest method testCountFieldInvalid.
@Test(expectedExceptions = BulletException.class, expectedExceptionsMessageRegExp = "COUNT_FIELD is not a valid operation\\.")
public void testCountFieldInvalid() {
GroupOperation operation = new GroupOperation(GroupOperation.GroupOperationType.COUNT_FIELD, "abc", null);
new GroupAll(Collections.singleton(operation));
}
use of com.yahoo.bullet.querying.aggregations.grouping.GroupOperation in project bullet-core by yahoo.
the class GroupByTest method testCountFieldInvalid.
@Test(expectedExceptions = BulletException.class, expectedExceptionsMessageRegExp = "COUNT_FIELD is not a valid operation\\.")
public void testCountFieldInvalid() {
GroupOperation operation = new GroupOperation(GroupOperation.GroupOperationType.COUNT_FIELD, "abc", null);
new GroupBy(null, Collections.singletonMap("abc", "def"), Collections.singleton(operation));
}
use of com.yahoo.bullet.querying.aggregations.grouping.GroupOperation in project bullet-core by yahoo.
the class GroupByTest method testOperations.
@Test
public void testOperations() {
GroupBy aggregation = new GroupBy(null, Collections.singletonMap("abc", "def"), Collections.emptySet());
Assert.assertEquals(aggregation.getOperations(), Collections.emptySet());
Set<GroupOperation> operations = new HashSet<>();
operations.add(new GroupOperation(GroupOperation.GroupOperationType.SUM, "abc", "sum"));
operations.add(new GroupOperation(GroupOperation.GroupOperationType.COUNT, null, "count"));
aggregation = new GroupBy(null, Collections.singletonMap("abc", "def"), operations);
Assert.assertEquals(aggregation.getOperations(), new HashSet<>(Arrays.asList(new GroupOperation(GroupOperation.GroupOperationType.SUM, "abc", "sum"), new GroupOperation(GroupOperation.GroupOperationType.COUNT, null, "count"))));
}
Aggregations