use of com.yahoo.bullet.query.aggregations.Raw in project bullet-core by yahoo.
the class IdentityPubSubMessageSerDeTest method testConvertingQuery.
@Test
public void testConvertingQuery() {
IdentityPubSubMessageSerDe serDe = new IdentityPubSubMessageSerDe(null);
Query query = new Query(new Projection(), null, new Raw(1), null, new Window(), 1L);
PubSubMessage actual = serDe.toMessage("id", query, "foo");
Assert.assertEquals(actual.getId(), "id");
Assert.assertSame(actual.getContent(), query);
Assert.assertEquals(actual.getMetadata().getContent(), "foo");
}
use of com.yahoo.bullet.query.aggregations.Raw in project bullet-core by yahoo.
the class QueryTest method testValidateOuterQueryNoNestedOuterQuery.
@Test(expectedExceptions = BulletException.class, expectedExceptionsMessageRegExp = "Outer query cannot have an outer query\\.")
public void testValidateOuterQueryNoNestedOuterQuery() {
Query nestedOuterQuery = new Query(new Projection(), null, new Raw(null), null, new Window(), null);
Query outerQuery = new Query(null, new Projection(), null, new Raw(null), null, nestedOuterQuery, new Window(), null);
new Query(null, new Projection(), null, new Raw(null), null, outerQuery, new Window(), null);
}
use of com.yahoo.bullet.query.aggregations.Raw in project bullet-core by yahoo.
the class QueryTest method testDuration.
@Test
public void testDuration() {
BulletConfig config = new BulletConfig();
Query query = new Query(new Projection(), null, new Raw(null), null, new Window(), null);
query.configure(config);
Assert.assertEquals(query.getDuration(), (Long) BulletConfig.DEFAULT_QUERY_DURATION);
query = new Query(new Projection(), null, new Raw(null), null, new Window(), -1000L);
query.configure(config);
Assert.assertEquals(query.getDuration(), (Long) BulletConfig.DEFAULT_QUERY_DURATION);
query = new Query(new Projection(), null, new Raw(null), null, new Window(), 0L);
query.configure(config);
Assert.assertEquals(query.getDuration(), (Long) BulletConfig.DEFAULT_QUERY_DURATION);
query = new Query(new Projection(), null, new Raw(null), null, new Window(), 1L);
query.configure(config);
Assert.assertEquals(query.getDuration(), (Long) 1L);
query = new Query(new Projection(), null, new Raw(null), null, new Window(), BulletConfig.DEFAULT_QUERY_DURATION);
query.configure(config);
Assert.assertEquals(query.getDuration(), (Long) BulletConfig.DEFAULT_QUERY_DURATION);
query = new Query(new Projection(), null, new Raw(null), null, new Window(), BulletConfig.DEFAULT_QUERY_MAX_DURATION);
query.configure(config);
Assert.assertEquals(query.getDuration(), (Long) BulletConfig.DEFAULT_QUERY_MAX_DURATION);
// Overflow
query = new Query(new Projection(), null, new Raw(null), null, new Window(), BulletConfig.DEFAULT_QUERY_MAX_DURATION * 2L);
query.configure(config);
Assert.assertEquals(query.getDuration(), (Long) BulletConfig.DEFAULT_QUERY_MAX_DURATION);
}
use of com.yahoo.bullet.query.aggregations.Raw in project bullet-core by yahoo.
the class QueryTest method testToString.
@Test
public void testToString() {
BulletConfig config = new BulletConfig();
config.set(BulletConfig.AGGREGATION_DEFAULT_SIZE, 1);
config.set(BulletConfig.QUERY_DEFAULT_DURATION, 30000L);
Query query = new Query(new Projection(), null, new Raw(null), null, new Window(), null);
query.configure(config.validate());
Assert.assertEquals(query.toString(), "{tableFunction: null, projection: {fields: null, type: PASS_THROUGH}, filter: null, " + "aggregation: {size: 1, type: RAW}, postAggregations: null, " + "window: {emitEvery: null, emitType: null, includeType: null, includeFirst: null}, " + "duration: 30000, outerQuery: null}");
}
use of com.yahoo.bullet.query.aggregations.Raw in project bullet-core by yahoo.
the class QueryTest method testDefaults.
@Test
public void testDefaults() {
Query query = new Query(new Projection(), null, new Raw(null), null, new Window(), null);
BulletConfig config = new BulletConfig();
query.configure(config);
Assert.assertEquals(query.getDuration(), (Long) BulletConfig.DEFAULT_QUERY_DURATION);
Assert.assertEquals(query.getAggregation().getSize(), (Integer) BulletConfig.DEFAULT_AGGREGATION_SIZE);
}
Aggregations