Search in sources :

Example 1 with StructField

use of com.google.zetasql.StructType.StructField in project beam by apache.

the class ZetaSqlDialectSpecTest method testIsNotNull3.

@Test
public void testIsNotNull3() {
    String sql = "SELECT @p0 IS NOT NULL AS ColA";
    ImmutableMap<String, Value> params = ImmutableMap.of("p0", Value.createNullValue(TypeFactory.createStructType(Arrays.asList(new StructField("a", TypeFactory.createSimpleType(TypeKind.TYPE_STRING))))));
    PCollection<Row> stream = execute(sql, params);
    final Schema schema = Schema.builder().addNullableField("field1", FieldType.BOOLEAN).build();
    PAssert.that(stream).containsInAnyOrder(Row.withSchema(schema).addValues(false).build());
    pipeline.run().waitUntilFinish(Duration.standardMinutes(PIPELINE_EXECUTION_WAITTIME_MINUTES));
}
Also used : StructField(com.google.zetasql.StructType.StructField) Schema(org.apache.beam.sdk.schemas.Schema) Value(com.google.zetasql.Value) ByteString(com.google.protobuf.ByteString) Row(org.apache.beam.sdk.values.Row) Test(org.junit.Test)

Aggregations

ByteString (com.google.protobuf.ByteString)1 StructField (com.google.zetasql.StructType.StructField)1 Value (com.google.zetasql.Value)1 Schema (org.apache.beam.sdk.schemas.Schema)1 Row (org.apache.beam.sdk.values.Row)1 Test (org.junit.Test)1