Search in sources :

Example 31 with Raw

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

the class RunningQueryTest method testStartTime.

@Test
public void testStartTime() {
    long start = System.currentTimeMillis();
    BulletConfig config = new BulletConfig();
    Query query = new Query(new Projection(), null, new Raw(null), null, new Window(), null);
    query.configure(config);
    RunningQuery runningQuery = new RunningQuery("foo", query, new Metadata(null, null));
    long end = System.currentTimeMillis();
    Assert.assertTrue(runningQuery.getStartTime() >= start);
    Assert.assertTrue(runningQuery.getStartTime() <= end);
    Assert.assertFalse(runningQuery.isTimedOut());
}
Also used : Window(com.yahoo.bullet.query.Window) Query(com.yahoo.bullet.query.Query) Metadata(com.yahoo.bullet.pubsub.Metadata) Projection(com.yahoo.bullet.query.Projection) Raw(com.yahoo.bullet.query.aggregations.Raw) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Example 32 with Raw

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

the class QueryTest method testValidateOuterQueryNoWindow.

@Test(expectedExceptions = BulletException.class, expectedExceptionsMessageRegExp = "Outer query cannot have a window\\.")
public void testValidateOuterQueryNoWindow() {
    Query outerQuery = new Query(new Projection(), null, new Raw(null), null, new Window(1, Window.Unit.RECORD), null);
    new Query(null, new Projection(), null, new Raw(null), null, outerQuery, new Window(), null);
}
Also used : Raw(com.yahoo.bullet.query.aggregations.Raw) Test(org.testng.annotations.Test)

Example 33 with Raw

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

the class QueryTest method testDisableWindowing.

@Test
public void testDisableWindowing() {
    BulletConfig config = new BulletConfig();
    config.set(BulletConfig.WINDOW_DISABLE, true);
    config.validate();
    Query query = new Query(new Projection(), null, new Raw(null), null, WindowUtils.makeSlidingWindow(1), null);
    query.configure(config);
    Assert.assertNull(query.getWindow().getEmitEvery());
    Assert.assertNull(query.getWindow().getEmitType());
    Assert.assertNull(query.getWindow().getIncludeType());
    Assert.assertNull(query.getWindow().getIncludeFirst());
}
Also used : Raw(com.yahoo.bullet.query.aggregations.Raw) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Example 34 with Raw

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

the class QueryTest method testWindowing.

@Test
public void testWindowing() {
    BulletConfig config = new BulletConfig();
    Query query = new Query(new Projection(), null, new Raw(null), null, WindowUtils.makeTumblingWindow(1), null);
    query.configure(config);
    Assert.assertEquals(query.getWindow().getEmitEvery(), (Integer) BulletConfig.DEFAULT_WINDOW_MIN_EMIT_EVERY);
}
Also used : Raw(com.yahoo.bullet.query.aggregations.Raw) BulletConfig(com.yahoo.bullet.common.BulletConfig) Test(org.testng.annotations.Test)

Example 35 with Raw

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

the class QueryUtils method makeSimpleAggregationFilterQuery.

public static Query makeSimpleAggregationFilterQuery(Expression filter, Integer size, Window.Unit emit, Integer emitValue, Window.Unit include, Integer includeValue) {
    Window window = WindowUtils.makeWindow(emit, emitValue, include, includeValue);
    Query query = new Query(new Projection(), filter, new Raw(size), null, window, null);
    query.configure(new BulletConfig());
    return query;
}
Also used : Raw(com.yahoo.bullet.query.aggregations.Raw) BulletConfig(com.yahoo.bullet.common.BulletConfig)

Aggregations

Raw (com.yahoo.bullet.query.aggregations.Raw)40 Test (org.testng.annotations.Test)33 Projection (com.yahoo.bullet.query.Projection)27 Query (com.yahoo.bullet.query.Query)27 Window (com.yahoo.bullet.query.Window)26 BulletConfig (com.yahoo.bullet.common.BulletConfig)21 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 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 Operation (com.yahoo.bullet.query.expressions.Operation)3 Computation (com.yahoo.bullet.query.postaggregations.Computation)3 Culling (com.yahoo.bullet.query.postaggregations.Culling)3