title: I want to change value in Protobuf and then convert protobuf to Spark DataSet Row
body: <p>I am new to Spark and I want to make a change in an existing protobuf. After I make change I want to map that protobuf message to a Spark Dataset Row. Since the protobuf message is complex and deeply nested.</p>
  
  <p>I dont want to create a schema and then copy values, which is tedious and hard to hand code</p>
  
  <p>Something like this:</p>
  
  <pre><code> Dataset&lt;Row&gt; events = spark
                  .readStream()
                  .format("kafka")
                  .load();
  
  //call mapper
  events.mapPartitions()
  
  ....
  ...
  
  
  //mapper code
  
  ProtoMessage.message
  
  //create schema
  StructType SCHEMA = new StructType()
          .add("value1", DataTypes.StringType, false)
          .add("value2", DataTypes.StringType, false)
  
  
  //create columns
  Object[] columnes = {
  message.getValue1(),
  message.getValue2()
  ....
  
  }
  
  //create a row
  Stream.&lt;Row&gt;of(new GenericRowWithSchema(columns, SCHEMA));
  </code></pre>
  
  <p>However I do not know the exact number of columns (Well I do know but its nearly impossible to hand code all)
  basically What I want to do is get the protobuf, change one field and then convert whole thing to a Dataset Row. </p>
  
  <p>I have looked into <strong>sparksql-protobuf</strong>, but I want to copy values also along after inferring the schema.</p>
  
  <p>I appreciate the help!</p>