title: How to use use foreach operator in pyspark in Structured Streaming (fails with 'DataStreamWriter' object has no attribute 'foreach')?
body: <p>I use Structured Streaming in pyspark 2.3.4.</p>
  
  <p>I'm trying to use <code>foreach</code> operator as follows:</p>
  
  <pre><code>query = prediction.writeStream.format('console').foreach(process_row).start()
  </code></pre>
  
  <p>I get the following error:</p>
  
  <blockquote>
    <p>AttributeError: 'DataStreamWriter' object has no attribute 'foreach'</p>
  </blockquote>
  
  <p>What is the problem here??</p>