use of org.apache.samza.sql.SamzaSqlRelRecord in project samza by apache.
the class TestGetSqlFieldUdf method testMultiLevelInvalidIntermediateField.
@Test(expected = IllegalArgumentException.class)
public void testMultiLevelInvalidIntermediateField() {
SamzaSqlRelRecord record = createRecord("bar.baz.baf.foo");
GetSqlFieldUdf getSqlFieldUdf = new GetSqlFieldUdf();
getSqlFieldUdf.execute(record, "bar.baz.bacon");
}
use of org.apache.samza.sql.SamzaSqlRelRecord in project samza by apache.
the class TestGetSqlFieldUdf method testSingleLevel.
@Test
public void testSingleLevel() {
SamzaSqlRelRecord record = createRecord("foo");
GetSqlFieldUdf getSqlFieldUdf = new GetSqlFieldUdf();
Assert.assertEquals(getSqlFieldUdf.execute(record, "foo"), "bar");
}
use of org.apache.samza.sql.SamzaSqlRelRecord in project samza by apache.
the class TestGetSqlFieldUdf method testArrayAtIntermediateFields.
@Test
public void testArrayAtIntermediateFields() {
SamzaSqlRelRecord record = createRecord("bar.baz[3].baf[2].foo");
GetSqlFieldUdf getSqlFieldUdf = new GetSqlFieldUdf();
Assert.assertEquals(getSqlFieldUdf.execute(record, "bar.baz[3].baf[2].foo"), "bar");
}
use of org.apache.samza.sql.SamzaSqlRelRecord in project samza by apache.
the class TestGetSqlFieldUdf method testSingleLevelInvalidField.
@Test(expected = IllegalArgumentException.class)
public void testSingleLevelInvalidField() {
SamzaSqlRelRecord record = createRecord("foo");
GetSqlFieldUdf getSqlFieldUdf = new GetSqlFieldUdf();
getSqlFieldUdf.execute(record, "bar");
}
use of org.apache.samza.sql.SamzaSqlRelRecord in project samza by apache.
the class TestSamzaSqlRelRecordSerde method testWithDifferentFields.
@Test
public void testWithDifferentFields() {
SamzaSqlRelRecord record = new SamzaSqlRelMessage(names, values, new SamzaSqlRelMsgMetadata(0L, 0L)).getSamzaSqlRelRecord();
SamzaSqlRelRecordSerde serde = (SamzaSqlRelRecordSerde) new SamzaSqlRelRecordSerdeFactory().getSerde(null, null);
SamzaSqlRelRecord resultRecord = serde.fromBytes(serde.toBytes(record));
Assert.assertEquals(names, resultRecord.getFieldNames());
Assert.assertEquals(values, resultRecord.getFieldValues());
}
Aggregations