use of com.yahoo.bullet.parsing.Projection in project bullet-core by yahoo.
the class ProjectionOperationsTest method testRepeatedProjections.
@Test
public void testRepeatedProjections() {
Projection first = makeProjection("field", "id");
Projection second = makeProjection("map_field.foo", "bar");
RecordBox box = RecordBox.get().add("field", "test").addMap("map_field", Pair.of("foo", "baz"));
BulletRecord record = box.getRecord();
BulletRecord firstProjection = ProjectionOperations.project(record, first);
BulletRecord secondProjection = ProjectionOperations.project(record, second);
box = RecordBox.get().add("field", "test").addMap("map_field", Pair.of("foo", "baz"));
BulletRecord expectedOriginal = box.getRecord();
Assert.assertEquals(record, expectedOriginal);
box = RecordBox.get().add("id", "test");
BulletRecord expectedFirstProjection = box.getRecord();
Assert.assertEquals(firstProjection, expectedFirstProjection);
box = RecordBox.get().add("bar", "baz");
BulletRecord expectedSecondProjection = box.getRecord();
Assert.assertEquals(secondProjection, expectedSecondProjection);
}
use of com.yahoo.bullet.parsing.Projection in project bullet-core by yahoo.
the class ProjectionOperationsTest method testDefaults.
@Test
public void testDefaults() {
Projection projection = new Projection();
Assert.assertNull(projection.getFields());
BulletRecord record = RecordBox.get().add("foo", "bar").getRecord();
BulletRecord actual = ProjectionOperations.project(record, projection);
BulletRecord expected = RecordBox.get().add("foo", "bar").getRecord();
Assert.assertEquals(actual, expected);
}
Aggregations