Search in sources :

Example 56 with Query

use of com.yahoo.bullet.query.Query 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 57 with Query

use of com.yahoo.bullet.query.Query 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)

Example 58 with Query

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

the class SimpleEqualityPartitionerTest method testDefaultPartitioningQueryWithNullEqualityFilters.

@Test
public void testDefaultPartitioningQueryWithNullEqualityFilters() {
    SimpleEqualityPartitioner partitioner = createPartitioner("A", "B");
    Query query = createQuery(new BinaryExpression(new FieldExpression("A"), new ValueExpression(null), Operation.EQUALS), new BinaryExpression(new FieldExpression("B"), new ValueExpression(null), Operation.EQUALS));
    Assert.assertEquals(partitioner.getKeys(query), singleton("null-null"));
}
Also used : Query(com.yahoo.bullet.query.Query) BinaryExpression(com.yahoo.bullet.query.expressions.BinaryExpression) ValueExpression(com.yahoo.bullet.query.expressions.ValueExpression) FieldExpression(com.yahoo.bullet.query.expressions.FieldExpression) Test(org.testng.annotations.Test)

Example 59 with Query

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

the class SimpleEqualityPartitionerTest method testPartitioningForQueryWithAllFieldsOperandsFlipped.

@Test
public void testPartitioningForQueryWithAllFieldsOperandsFlipped() {
    SimpleEqualityPartitioner partitioner = createPartitioner("A", "B", "C");
    Query query = createQuery(new BinaryExpression(new ValueExpression("bar"), new FieldExpression("A"), Operation.EQUALS), new BinaryExpression(new ValueExpression("baz"), new FieldExpression("B"), Operation.EQUALS), new BinaryExpression(new ValueExpression("qux"), new FieldExpression("C"), Operation.EQUALS));
    Assert.assertEquals(partitioner.getKeys(query), singleton("bar.-baz.-qux."));
}
Also used : Query(com.yahoo.bullet.query.Query) BinaryExpression(com.yahoo.bullet.query.expressions.BinaryExpression) ValueExpression(com.yahoo.bullet.query.expressions.ValueExpression) FieldExpression(com.yahoo.bullet.query.expressions.FieldExpression) Test(org.testng.annotations.Test)

Example 60 with Query

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

the class SimpleEqualityPartitionerTest method testPartitioningForQueryWithNestedFields.

@Test
public void testPartitioningForQueryWithNestedFields() {
    SimpleEqualityPartitioner partitioner = createPartitioner("A", "B", "C", "D.e");
    Query query = createQuery(new BinaryExpression(new FieldExpression("A"), new ValueExpression("bar"), Operation.EQUALS), new BinaryExpression(new FieldExpression("B"), new ValueExpression("quux"), Operation.EQUALS), new BinaryExpression(new FieldExpression("C"), new ValueExpression("qux"), Operation.EQUALS), new BinaryExpression(new FieldExpression("D", "e"), new ValueExpression("norf"), Operation.EQUALS));
    Assert.assertEquals(partitioner.getKeys(query), singleton("bar.-quux.-qux.-norf."));
}
Also used : Query(com.yahoo.bullet.query.Query) BinaryExpression(com.yahoo.bullet.query.expressions.BinaryExpression) ValueExpression(com.yahoo.bullet.query.expressions.ValueExpression) FieldExpression(com.yahoo.bullet.query.expressions.FieldExpression) Test(org.testng.annotations.Test)

Aggregations

Query (com.yahoo.bullet.query.Query)62 Test (org.testng.annotations.Test)55 Projection (com.yahoo.bullet.query.Projection)29 Window (com.yahoo.bullet.query.Window)28 Raw (com.yahoo.bullet.query.aggregations.Raw)27 FieldExpression (com.yahoo.bullet.query.expressions.FieldExpression)26 BulletConfigTest (com.yahoo.bullet.common.BulletConfigTest)25 BinaryExpression (com.yahoo.bullet.query.expressions.BinaryExpression)24 ValueExpression (com.yahoo.bullet.query.expressions.ValueExpression)24 BulletConfig (com.yahoo.bullet.common.BulletConfig)22 BulletRecord (com.yahoo.bullet.record.BulletRecord)13 Expression (com.yahoo.bullet.query.expressions.Expression)11 ListExpression (com.yahoo.bullet.query.expressions.ListExpression)11 UnaryExpression (com.yahoo.bullet.query.expressions.UnaryExpression)11 Field (com.yahoo.bullet.query.Field)6 Metadata (com.yahoo.bullet.pubsub.Metadata)5 RecordBox (com.yahoo.bullet.result.RecordBox)5 TableFunction (com.yahoo.bullet.query.tablefunctions.TableFunction)4 CountDistinct (com.yahoo.bullet.query.aggregations.CountDistinct)3 GroupAll (com.yahoo.bullet.query.aggregations.GroupAll)3