use of com.yahoo.bullet.parsing.Aggregation in project bullet-core by yahoo.
the class RunningQueryTest method testTimingOut.
@Test
public void testTimingOut() throws Exception {
BulletConfig config = new BulletConfig();
Query query = new Query();
query.setAggregation(new Aggregation());
query.setDuration(1L);
query.configure(config);
Assert.assertFalse(query.initialize().isPresent());
RunningQuery runningQuery = new RunningQuery("foo", query);
Assert.assertFalse(runningQuery.initialize().isPresent());
// Sleep to make sure it's 1 ms
Thread.sleep(1);
Assert.assertTrue(runningQuery.isTimedOut());
}
use of com.yahoo.bullet.parsing.Aggregation in project bullet-core by yahoo.
the class RunningQueryTest method testCreatingWithQuery.
@Test
public void testCreatingWithQuery() {
BulletConfig config = new BulletConfig();
Query query = new Query();
query.setAggregation(new Aggregation());
query.configure(config);
Assert.assertFalse(query.initialize().isPresent());
RunningQuery runningQuery = new RunningQuery("foo", query);
Assert.assertFalse(runningQuery.initialize().isPresent());
Assert.assertEquals(runningQuery.getId(), "foo");
Assert.assertNotNull(runningQuery.getQuery());
String actual = runningQuery.toString();
Assert.assertTrue(actual.contains("{"));
Assert.assertTrue(actual.contains("filters: null, projection: null,"));
Assert.assertTrue(actual.contains("aggregation: {size: 500, type: RAW, fields: null, attributes: null},"));
Assert.assertTrue(actual.contains("window: null, duration:"));
Assert.assertTrue(actual.contains("}"));
}
use of com.yahoo.bullet.parsing.Aggregation in project bullet-core by yahoo.
the class WindowingOperationsTest method testNotForcingNonRawToTumbling.
@Test
public void testNotForcingNonRawToTumbling() {
BulletConfig config = new BulletConfig();
Query query = new Query();
Window window = WindowUtils.makeReactiveWindow();
window.configure(config);
query.setWindow(window);
Aggregation aggregation = new Aggregation();
aggregation.setType(Aggregation.Type.GROUP);
query.setAggregation(aggregation);
Assert.assertEquals(WindowingOperations.findScheme(query, null, config).getClass(), Reactive.class);
}
use of com.yahoo.bullet.parsing.Aggregation in project bullet-core by yahoo.
the class WindowingOperationsTest method testAdditiveTumblingWindow.
@Test
public void testAdditiveTumblingWindow() {
BulletConfig config = new BulletConfig();
Query query = new Query();
Window window = WindowUtils.makeWindow(Window.Unit.TIME, 1000, Window.Unit.ALL, null);
window.configure(config);
query.setWindow(window);
Aggregation aggregation = new Aggregation();
aggregation.setType(Aggregation.Type.GROUP);
query.setAggregation(aggregation);
Assert.assertEquals(WindowingOperations.findScheme(query, null, config).getClass(), AdditiveTumbling.class);
}
use of com.yahoo.bullet.parsing.Aggregation in project bullet-core by yahoo.
the class WindowingOperationsTest method testOtherWindowsForcedToTumbling.
@Test
public void testOtherWindowsForcedToTumbling() {
BulletConfig config = new BulletConfig();
Query query = new Query();
Window window = WindowUtils.makeWindow(Window.Unit.TIME, 1000, Window.Unit.RECORD, 4);
window.configure(config);
query.setWindow(window);
Aggregation aggregation = new Aggregation();
aggregation.setType(Aggregation.Type.COUNT_DISTINCT);
query.setAggregation(aggregation);
Assert.assertEquals(WindowingOperations.findScheme(query, null, config).getClass(), Tumbling.class);
}
Aggregations