Search in sources :

Example 11 with SamzaSqlRelRecord

use of org.apache.samza.sql.SamzaSqlRelRecord in project samza by apache.

the class TestGetSqlFieldUdf method testMapAtIntermediateFields.

@Test
public void testMapAtIntermediateFields() {
    SamzaSqlRelRecord record = createRecord("bar.map:baz.map:baf.foo");
    GetSqlFieldUdf getSqlFieldUdf = new GetSqlFieldUdf();
    Assert.assertEquals(getSqlFieldUdf.execute(record, "bar.baz.baf.foo"), "bar");
}
Also used : SamzaSqlRelRecord(org.apache.samza.sql.SamzaSqlRelRecord) Test(org.junit.Test)

Example 12 with SamzaSqlRelRecord

use of org.apache.samza.sql.SamzaSqlRelRecord in project samza by apache.

the class TestGetSqlFieldUdf method testNullFields.

@Test(expected = NullPointerException.class)
public void testNullFields() {
    SamzaSqlRelRecord record = createRecord("bar.baz.baf.foo");
    GetSqlFieldUdf getSqlFieldUdf = new GetSqlFieldUdf();
    getSqlFieldUdf.execute(record, null);
}
Also used : SamzaSqlRelRecord(org.apache.samza.sql.SamzaSqlRelRecord) Test(org.junit.Test)

Example 13 with SamzaSqlRelRecord

use of org.apache.samza.sql.SamzaSqlRelRecord in project samza by apache.

the class TestGetSqlFieldUdf method testMultiLevelInvalidFinalField.

@Test(expected = IllegalArgumentException.class)
public void testMultiLevelInvalidFinalField() {
    SamzaSqlRelRecord record = createRecord("bar.baz.baf.foo");
    GetSqlFieldUdf getSqlFieldUdf = new GetSqlFieldUdf();
    getSqlFieldUdf.execute(record, "bar.baz.baf.funny");
}
Also used : SamzaSqlRelRecord(org.apache.samza.sql.SamzaSqlRelRecord) Test(org.junit.Test)

Example 14 with SamzaSqlRelRecord

use of org.apache.samza.sql.SamzaSqlRelRecord in project samza by apache.

the class TestGetSqlFieldUdf method testMapAtAllIntermediateFields.

@Test
public void testMapAtAllIntermediateFields() {
    SamzaSqlRelRecord record = createRecord("bar.map:baz.map:baf.map:foo");
    GetSqlFieldUdf getSqlFieldUdf = new GetSqlFieldUdf();
    Assert.assertEquals(getSqlFieldUdf.execute(record, "bar.baz.baf.foo"), "bar");
}
Also used : SamzaSqlRelRecord(org.apache.samza.sql.SamzaSqlRelRecord) Test(org.junit.Test)

Example 15 with SamzaSqlRelRecord

use of org.apache.samza.sql.SamzaSqlRelRecord in project samza by apache.

the class TestGetSqlFieldUdf method testMapAtLastField.

@Test
public void testMapAtLastField() {
    SamzaSqlRelRecord record = createRecord("bar.baz.baf.map:foo");
    GetSqlFieldUdf getSqlFieldUdf = new GetSqlFieldUdf();
    Assert.assertEquals(getSqlFieldUdf.execute(record, "bar.baz.baf.foo"), "bar");
}
Also used : SamzaSqlRelRecord(org.apache.samza.sql.SamzaSqlRelRecord) Test(org.junit.Test)

Aggregations

SamzaSqlRelRecord (org.apache.samza.sql.SamzaSqlRelRecord)31 Test (org.junit.Test)25 ArrayList (java.util.ArrayList)6 SamzaSqlRelMessage (org.apache.samza.sql.data.SamzaSqlRelMessage)5 List (java.util.List)3 Schema (org.apache.avro.Schema)3 JoinRelType (org.apache.calcite.rel.core.JoinRelType)3 SamzaSqlRelMsgMetadata (org.apache.samza.sql.data.SamzaSqlRelMsgMetadata)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 GenericData (org.apache.avro.generic.GenericData)2 ByteString (org.apache.calcite.avatica.util.ByteString)2 SamzaException (org.apache.samza.SamzaException)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 Preconditions (com.google.common.base.Preconditions)1 Collections (java.util.Collections)1 LinkedList (java.util.LinkedList)1 Collectors (java.util.stream.Collectors)1 GenericRecord (org.apache.avro.generic.GenericRecord)1 IndexedRecord (org.apache.avro.generic.IndexedRecord)1