Search in sources :

Example 36 with Window

use of com.yahoo.bullet.query.Window in project bullet-core by yahoo.

the class SlidingRecordTest method testCreation.

@Test
public void testCreation() {
    Window window = makeSlidingWindow(10);
    SlidingRecord sliding = new SlidingRecord(strategy, window, config);
    Assert.assertFalse(sliding.isClosed());
    Assert.assertFalse(sliding.isClosedForPartition());
}
Also used : Window(com.yahoo.bullet.query.Window) Test(org.testng.annotations.Test)

Example 37 with Window

use of com.yahoo.bullet.query.Window in project bullet-core by yahoo.

the class SlidingRecordTest method testReachingWindowSizeOnConsume.

@Test
public void testReachingWindowSizeOnConsume() {
    Window window = makeSlidingWindow(5);
    SlidingRecord sliding = new SlidingRecord(strategy, window, config);
    Assert.assertFalse(sliding.isClosed());
    Assert.assertFalse(sliding.isClosedForPartition());
    for (int i = 0; i < 4; ++i) {
        sliding.consume(RecordBox.get().getRecord());
        Assert.assertFalse(sliding.isClosed());
        Assert.assertTrue(sliding.isClosedForPartition());
    }
    sliding.consume(RecordBox.get().getRecord());
    Assert.assertTrue(sliding.isClosed());
    Assert.assertTrue(sliding.isClosedForPartition());
    Assert.assertEquals(strategy.getConsumeCalls(), 5);
}
Also used : Window(com.yahoo.bullet.query.Window) Test(org.testng.annotations.Test)

Example 38 with Window

use of com.yahoo.bullet.query.Window in project bullet-core by yahoo.

the class AdditiveTumblingTest method testNotClosedOnStrategyClosed.

@Test
public void testNotClosedOnStrategyClosed() {
    Window window = WindowUtils.makeWindow(Window.Unit.TIME, Integer.MAX_VALUE, Window.Unit.ALL, null);
    ClosableStrategy strategy = new ClosableStrategy();
    AdditiveTumbling additiveTumbling = new AdditiveTumbling(strategy, window, config);
    Assert.assertFalse(additiveTumbling.isClosed());
    Assert.assertFalse(additiveTumbling.isClosedForPartition());
    strategy.setClosed(true);
    Assert.assertFalse(additiveTumbling.isClosed());
    Assert.assertFalse(additiveTumbling.isClosedForPartition());
}
Also used : Window(com.yahoo.bullet.query.Window) Test(org.testng.annotations.Test)

Example 39 with Window

use of com.yahoo.bullet.query.Window in project bullet-core by yahoo.

the class AdditiveTumblingTest method makeAdditiveTumblingWindow.

private Window makeAdditiveTumblingWindow(int length) {
    Window window = WindowUtils.makeWindow(Window.Unit.TIME, length, Window.Unit.ALL, null);
    window.configure(config);
    return window;
}
Also used : Window(com.yahoo.bullet.query.Window)

Example 40 with Window

use of com.yahoo.bullet.query.Window in project bullet-core by yahoo.

the class TumblingTest method makeTumblingWindow.

private Window makeTumblingWindow(int length) {
    Window window = WindowUtils.makeTumblingWindow(length);
    window.configure(config);
    return window;
}
Also used : Window(com.yahoo.bullet.query.Window)

Aggregations

Window (com.yahoo.bullet.query.Window)42 Test (org.testng.annotations.Test)34 Projection (com.yahoo.bullet.query.Projection)28 Query (com.yahoo.bullet.query.Query)28 Raw (com.yahoo.bullet.query.aggregations.Raw)26 BulletConfigTest (com.yahoo.bullet.common.BulletConfigTest)17 FieldExpression (com.yahoo.bullet.query.expressions.FieldExpression)12 BinaryExpression (com.yahoo.bullet.query.expressions.BinaryExpression)11 ValueExpression (com.yahoo.bullet.query.expressions.ValueExpression)11 BulletConfig (com.yahoo.bullet.common.BulletConfig)10 Expression (com.yahoo.bullet.query.expressions.Expression)10 ListExpression (com.yahoo.bullet.query.expressions.ListExpression)10 UnaryExpression (com.yahoo.bullet.query.expressions.UnaryExpression)10 BulletRecord (com.yahoo.bullet.record.BulletRecord)7 Field (com.yahoo.bullet.query.Field)6 Metadata (com.yahoo.bullet.pubsub.Metadata)5 RecordBox (com.yahoo.bullet.result.RecordBox)5 Map (java.util.Map)4 CountDistinct (com.yahoo.bullet.query.aggregations.CountDistinct)3 GroupAll (com.yahoo.bullet.query.aggregations.GroupAll)3