title: Writing dataframe to kafka topic in an avro format for spark < 2.4?
body: <p>Q1. Considering I have a dataframe <code>df</code> and a schema <code>myschema</code>, how do I proceed to write the dataframe into kafka topic in an avro format ?</p>
  
  <p>Q2. Is there any optimized way if we do not consider <code>udf</code> ?</p>
  
  <p>Most of the available solutions are for spark > 2.4 where they have inbuilt avro functions to use.</p>