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);
}
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."));
}
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("*-*"));
}
Aggregations