public static SerializableFunction<Row, byte[]> getRowToProtoBytesFromSchema(
      String schemaString, String messageName) {

    Descriptors.Descriptor descriptor = getDescriptorFromProtoSchema(schemaString, messageName);

    ProtoDynamicMessageSchema<DynamicMessage> protoDynamicMessageSchema =
        ProtoDynamicMessageSchema.forDescriptor(ProtoDomain.buildFrom(descriptor), descriptor);
    return new SimpleFunction<Row, byte[]>() {
      @Override
      public byte[] apply(Row input) {
        SerializableFunction<Row, DynamicMessage> res =
            protoDynamicMessageSchema.getFromRowFunction();
        return res.apply(input).toByteArray();
      }
    };
  }
@Test
  public void testRowToProtoSchemaWithPackageFunction() {
    Row row =
        Row.withSchema(SCHEMA)
            .withFieldValue("id", 1234)
            .withFieldValue("name", "Doe")
            .withFieldValue("active", false)
            .withFieldValue("address.city", "seattle")
            .withFieldValue("address.street", "fake street")
            .withFieldValue("address.zip_code", "TO-1234")
            .withFieldValue("address.state", "wa")
            .build();

    byte[] byteArray = {
      8, -46, 9, 18, 3, 68, 111, 101, 34, 35, 10, 7, 115, 101, 97, 116, 116, 108, 101, 18, 11, 102,
      97, 107, 101, 32, 115, 116, 114, 101, 101, 116, 26, 2, 119, 97, 34, 7, 84, 79, 45, 49, 50, 51,
      52
    };

    byte[] resultBytes =
        ProtoByteUtils.getRowToProtoBytesFromSchema(
                PROTO_STRING_PACKAGE_SCHEMA, "com.test.proto.MyMessage")
            .apply(row);

    Assert.assertNotNull(resultBytes);
    Assert.assertArrayEquals(byteArray, resultBytes);
  }