use of com.yahoo.bullet.parsing.Aggregation in project bullet-core by yahoo.
the class GroupByTest method testAttributeOperationsUnknownOperation.
@Test
public void testAttributeOperationsUnknownOperation() {
Aggregation aggregation = makeAggregation(emptyMap(), 10, null);
aggregation.setAttributes(makeAttributes(makeGroupOperation(COUNT, null, "bar"), makeGroupOperation(COUNT_FIELD, "foo", "foo_avg")));
GroupBy groupBy = makeGroupBy(new BulletConfig(), aggregation, ALL_METADATA);
// The bad operation should have been thrown out.
Assert.assertFalse(groupBy.initialize().isPresent());
}
use of com.yahoo.bullet.parsing.Aggregation in project bullet-core by yahoo.
the class GroupByTest method testAttributeOperationsDuplicateOperation.
@Test
public void testAttributeOperationsDuplicateOperation() {
Aggregation aggregation = makeAggregation(emptyMap(), 10, null);
aggregation.setAttributes(makeAttributes(makeGroupOperation(COUNT, null, null), makeGroupOperation(SUM, "foo", null), makeGroupOperation(COUNT, null, null), makeGroupOperation(SUM, "bar", null), makeGroupOperation(SUM, "foo", null), makeGroupOperation(SUM, "bar", null)));
GroupBy groupBy = makeGroupBy(new BulletConfig(), aggregation, ALL_METADATA);
// The bad ones should be removed.
Assert.assertFalse(groupBy.initialize().isPresent());
}
use of com.yahoo.bullet.parsing.Aggregation in project bullet-core by yahoo.
the class GroupByTest method makeAggregation.
public static Aggregation makeAggregation(Map<String, String> fields, int size, List<Map<String, String>> operations) {
Aggregation aggregation = new Aggregation();
aggregation.setType(GROUP);
aggregation.setFields(fields);
aggregation.setSize(size);
if (operations != null) {
aggregation.setAttributes(makeAttributes(operations));
}
return aggregation;
}
use of com.yahoo.bullet.parsing.Aggregation in project bullet-core by yahoo.
the class RawTest method makeRaw.
private static Raw makeRaw(int size, int maxSize) {
Aggregation aggregation = new Aggregation();
aggregation.setSize(size);
BulletConfig config = new BulletConfig();
config.set(BulletConfig.RAW_AGGREGATION_MAX_SIZE, maxSize);
Raw raw = new Raw(aggregation, config.validate());
raw.initialize();
return raw;
}
use of com.yahoo.bullet.parsing.Aggregation in project bullet-core by yahoo.
the class TopKTest method makeTopK.
public static TopK makeTopK(BulletConfig configuration, Map<String, Object> attributes, Map<String, String> fields, int size, List<Map.Entry<Concept, String>> metadata) {
Aggregation aggregation = new Aggregation();
aggregation.setType(Aggregation.Type.TOP_K);
aggregation.setFields(fields);
aggregation.setAttributes(attributes);
aggregation.setSize(size);
TopK topK = new TopK(aggregation, addMetadata(configuration, metadata));
topK.initialize();
return topK;
}
Aggregations