title: Update column value from another columns based on multiple conditions in spark structured streaming
body: <p>I want to update the value in one column using another two columns based on multiple conditions. For eg - the stream is like : </p>
  
  <pre><code>    +---+---+----+---+
      | A | B | C  | D |
      +---+---+----+---+
      | a | T | 10 | 0 |
      | a | T | 100| 0 |
      | a | L | 0  | 0 |
      | a | L | 1  | 0 |
      +---+---+----+---+
  </code></pre>
  
  <p>What I have is multiple conditions like - </p>
  
  <blockquote>
    <p>(B = "T" &amp;&amp; C > 20 ) OR (B = "L" &amp;&amp; C = 0)</p>
  </blockquote>
  
  <p>The values <code>"T"</code>, <code>20</code>, <code>"L"</code> and <code>0</code> are dynamic. <code>AND/OR</code> operators are also supplied at run-time. I want to make <code>D = 1</code> whenever the condition holds true else it should remain <code>D = 0</code>. The number of conditions are also dynamic.</p>
  
  <p>I tried using it with the <code>UPDATE</code> command in <code>spark-sql</code> i.e. <code>UPDATE df SET D = '1' WHERE CONDITIONS</code>. But it says that update is not yet supported. The resulting dataframe should be -</p>
  
  <pre><code>+---+---+----+---+
  | A | B | C  | D |
  +---+---+----+---+
  | a | T | 10 | 0 |
  | a | T | 100| 1 |
  | a | L | 0  | 1 |
  | a | L | 1  | 0 |
  +---+---+----+---+
  </code></pre>
  
  <p>Is there any way I can achieve this ?</p>