Search in sources :

Example 6 with Query

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

the class SimpleEqualityPartitionerTest method testPartitioningForQueryWithMissingFields.

@Test
public void testPartitioningForQueryWithMissingFields() {
    SimpleEqualityPartitioner partitioner = createPartitioner("A", "B");
    Query query = createQuery(new BinaryExpression(new FieldExpression("A"), new ValueExpression("bar"), Operation.EQUALS));
    Assert.assertEquals(partitioner.getKeys(query), singleton("bar.-*"));
}
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 7 with Query

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

the class SimpleEqualityPartitionerTest method testDefaultPartitioningForQueryWthImproperBinaryEquals.

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

Example 8 with Query

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

the class SimpleEqualityPartitionerTest method testPartitioningForQueryWithNullCheckedFields.

@Test
public void testPartitioningForQueryWithNullCheckedFields() {
    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 9 with Query

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

the class SimpleEqualityPartitionerTest method testDefaultPartitioningQueryWithNoEqualityFilters.

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

Example 10 with Query

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

the class SimpleEqualityPartitionerTest method testDefaultPartitioningQueryWithUnrelatedFilters.

@Test
public void testDefaultPartitioningQueryWithUnrelatedFilters() {
    SimpleEqualityPartitioner partitioner = createPartitioner("A", "B");
    Query query = createQuery(new BinaryExpression(new FieldExpression("C"), new ValueExpression("bar"), Operation.EQUALS), new BinaryExpression(new FieldExpression("D"), new ValueExpression("baz"), Operation.EQUALS));
    Assert.assertEquals(partitioner.getKeys(query), singleton("*-*"));
}
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