use of org.apache.beam.sdk.extensions.protobuf.Proto3SchemaMessages.MapPrimitive in project beam by apache.
the class ProtoDynamicMessageSchemaTest method testMapRowToProto.
@Test
public void testMapRowToProto() {
ProtoDynamicMessageSchema schemaProvider = schemaFromDescriptor(MapPrimitive.getDescriptor());
SerializableFunction<Row, DynamicMessage> fromRow = schemaProvider.getFromRowFunction();
MapPrimitive proto = parseFrom(fromRow.apply(MAP_PRIMITIVE_ROW).toString(), MapPrimitive.newBuilder()).build();
assertEquals(MAP_PRIMITIVE_PROTO, proto);
}
use of org.apache.beam.sdk.extensions.protobuf.Proto3SchemaMessages.MapPrimitive in project beam by apache.
the class ProtoDynamicMessageSchemaTest method testNullMapRowToProto.
@Test
public void testNullMapRowToProto() {
ProtoDynamicMessageSchema schemaProvider = schemaFromDescriptor(MapPrimitive.getDescriptor());
SerializableFunction<Row, DynamicMessage> fromRow = schemaProvider.getFromRowFunction();
MapPrimitive proto = parseFrom(fromRow.apply(NULL_MAP_PRIMITIVE_ROW).toString(), MapPrimitive.newBuilder()).build();
assertEquals(NULL_MAP_PRIMITIVE_PROTO, proto);
}
Aggregations