Search in sources :

Example 61 with FieldExpression

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

the class FieldEvaluatorTest method testEvaluateWithExpressionsAndNulls.

@Test
public void testEvaluateWithExpressionsAndNulls() {
    FieldEvaluator evaluator = new FieldEvaluator(new FieldExpression("abc", new FieldExpression("dne")));
    Assert.assertEquals(evaluator.evaluate(record), TypedObject.NULL);
    evaluator = new FieldEvaluator(new FieldExpression("abc", new FieldExpression("dne"), new FieldExpression("c")));
    Assert.assertEquals(evaluator.evaluate(record), TypedObject.NULL);
    evaluator = new FieldEvaluator(new FieldExpression("abc", new FieldExpression("a"), new FieldExpression("dne")));
    Assert.assertEquals(evaluator.evaluate(record), TypedObject.NULL);
    evaluator = new FieldEvaluator(new FieldExpression("abc", 0, new FieldExpression("dne")));
    Assert.assertEquals(evaluator.evaluate(record), TypedObject.NULL);
    evaluator = new FieldEvaluator(new FieldExpression("abc", new FieldExpression("dne"), "def"));
    Assert.assertEquals(evaluator.evaluate(record), TypedObject.NULL);
    evaluator = new FieldEvaluator(new FieldExpression("aaa", "abc", new FieldExpression("dne")));
    Assert.assertEquals(evaluator.evaluate(record), TypedObject.NULL);
}
Also used : FieldExpression(com.yahoo.bullet.query.expressions.FieldExpression) Test(org.testng.annotations.Test)

Example 62 with FieldExpression

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

the class SimpleEqualityPartitionerTest method testPartitioningForQueryWithAllFields.

@Test
public void testPartitioningForQueryWithAllFields() {
    SimpleEqualityPartitioner partitioner = createPartitioner("A", "B", "C");
    Query query = createQuery(new BinaryExpression(new FieldExpression("A"), new ValueExpression("bar"), Operation.EQUALS), new BinaryExpression(new FieldExpression("B"), new ValueExpression("baz"), Operation.EQUALS), new BinaryExpression(new FieldExpression("C"), new ValueExpression("qux"), 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 63 with FieldExpression

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

the class SimpleEqualityPartitionerTest method testDefaultPartitioningQueryWithNonEqualityFilters.

@Test
public void testDefaultPartitioningQueryWithNonEqualityFilters() {
    SimpleEqualityPartitioner partitioner = createPartitioner("A", "B");
    Query query = createQuery(new BinaryExpression(new FieldExpression("A"), new ValueExpression("bar"), Operation.NOT_EQUALS), new BinaryExpression(new FieldExpression("B"), new ValueExpression("baz"), Operation.NOT_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

FieldExpression (com.yahoo.bullet.query.expressions.FieldExpression)63 Test (org.testng.annotations.Test)60 BinaryExpression (com.yahoo.bullet.query.expressions.BinaryExpression)33 BulletRecord (com.yahoo.bullet.record.BulletRecord)33 ValueExpression (com.yahoo.bullet.query.expressions.ValueExpression)30 Query (com.yahoo.bullet.query.Query)27 UnaryExpression (com.yahoo.bullet.query.expressions.UnaryExpression)15 Explode (com.yahoo.bullet.query.tablefunctions.Explode)15 Clip (com.yahoo.bullet.result.Clip)13 ArrayList (java.util.ArrayList)13 Projection (com.yahoo.bullet.query.Projection)12 Window (com.yahoo.bullet.query.Window)12 Raw (com.yahoo.bullet.query.aggregations.Raw)12 Expression (com.yahoo.bullet.query.expressions.Expression)12 BulletConfigTest (com.yahoo.bullet.common.BulletConfigTest)11 ListExpression (com.yahoo.bullet.query.expressions.ListExpression)11 Field (com.yahoo.bullet.query.Field)9 LateralView (com.yahoo.bullet.query.tablefunctions.LateralView)7 BulletConfig (com.yahoo.bullet.common.BulletConfig)6 RecordBox (com.yahoo.bullet.result.RecordBox)6