title: How to insert processed spark stream into kafka
body: <p>am trying to insert spark stream into kafka after being processed using the below snippet</p>
  <pre><code>query = ds1 \
      .selectExpr(&quot;CAST(value AS STRING)&quot;)\
      .writeStream\
      .foreachBatch(do_something) \
      .format(&quot;kafka&quot;) \
      .option(&quot;topic&quot;,&quot;topic-name&quot;) \
      .option(&quot;kafka.bootstrap.servers&quot;, &quot;borkers-IPs&quot;) \
      .option(&quot;checkpointLocation&quot;, &quot;/home/location&quot;) \
      .start()
  </code></pre>
  <p>but it seems it's inserting the original stream not the processed one.</p>