Search in sources :

Example 36 with Raw

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

the class QueryUtils method makeProjectionFilterQuery.

public static Query makeProjectionFilterQuery(Expression filter, List<Field> fields) {
    Query query = new Query(new Projection(fields, false), filter, new Raw(1), null, new Window(), null);
    query.configure(new BulletConfig());
    return query;
}
Also used : Raw(com.yahoo.bullet.query.aggregations.Raw) BulletConfig(com.yahoo.bullet.common.BulletConfig)

Example 37 with Raw

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

the class ByteArrayPubSubMessageSerDeTest method testLazyMessage.

@Test
public void testLazyMessage() {
    ByteArrayPubSubMessageSerDe serDe = new ByteArrayPubSubMessageSerDe(null);
    Query query = new Query(new Projection(), null, new Raw(1), null, new Window(), 1L);
    PubSubMessage converted = serDe.toMessage("id", query, "foo");
    PubSubMessage reverted = serDe.fromMessage(converted);
    Assert.assertSame(reverted, converted);
    // Starts off as byte[]
    Assert.assertEquals(reverted.getContent(), SerializerDeserializer.toBytes(query));
    // Payload is now made a Query
    Query revertedQuery = reverted.getContentAsQuery();
    Assert.assertEquals(revertedQuery.getProjection().getType(), Projection.Type.PASS_THROUGH);
    Assert.assertEquals(revertedQuery.getAggregation().getType(), AggregationType.RAW);
    Assert.assertEquals((long) revertedQuery.getAggregation().getSize(), 1L);
    Assert.assertEquals((long) revertedQuery.getDuration(), 1L);
    Assert.assertSame(reverted.getContent(), revertedQuery);
    // Payload is now made a byte[]
    byte[] revertedByteArray = reverted.getContentAsByteArray();
    Assert.assertEquals(revertedByteArray, SerializerDeserializer.toBytes(query));
    Assert.assertSame(reverted.getContent(), revertedByteArray);
}
Also used : Window(com.yahoo.bullet.query.Window) Query(com.yahoo.bullet.query.Query) Projection(com.yahoo.bullet.query.Projection) Raw(com.yahoo.bullet.query.aggregations.Raw) Test(org.testng.annotations.Test)

Example 38 with Raw

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

the class ByteArrayPubSubMessageSerDeTest method testConvertingQuery.

@Test
public void testConvertingQuery() {
    ByteArrayPubSubMessageSerDe serDe = new ByteArrayPubSubMessageSerDe(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.assertEquals(actual.getContent(), SerializerDeserializer.toBytes(query));
    Assert.assertEquals(actual.getMetadata().getContent(), "foo");
}
Also used : Window(com.yahoo.bullet.query.Window) Query(com.yahoo.bullet.query.Query) Projection(com.yahoo.bullet.query.Projection) Raw(com.yahoo.bullet.query.aggregations.Raw) Test(org.testng.annotations.Test)

Example 39 with Raw

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

the class SimpleEqualityPartitionerTest method createQuery.

private Query createQuery() {
    Query query = new Query(new Projection(), null, new Raw(null), null, new Window(), null);
    query.configure(config);
    return query;
}
Also used : Window(com.yahoo.bullet.query.Window) Query(com.yahoo.bullet.query.Query) Projection(com.yahoo.bullet.query.Projection) Raw(com.yahoo.bullet.query.aggregations.Raw)

Example 40 with Raw

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

the class SimpleEqualityPartitionerTest method createQuery.

private Query createQuery(Expression filter) {
    Query query = new Query(new Projection(), filter, new Raw(null), null, new Window(), null);
    query.configure(config);
    return query;
}
Also used : Window(com.yahoo.bullet.query.Window) Query(com.yahoo.bullet.query.Query) Projection(com.yahoo.bullet.query.Projection) Raw(com.yahoo.bullet.query.aggregations.Raw)

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