title: Pyspark Cummulative sum with conditions
body: <p>I have a pyspark dataframe with 3 columns:</p>
  
  <p><em>ID</em>, each appearing multiple times;
  <em>DATE</em>;
  <em>DELAY</em>, 0 if this bill was payed on time, 1 otherwise.</p>
  
  <p>It's already ordered by <em>ID</em> and <em>DATE</em>.
  I need to create a column named <em>CONSECUTIVE</em> that shows how many consecutive bills were paid consecutively with <em>DELAY=1</em> for each ID.</p>
  
  <p>Example of data, and  expected result:</p>
  
  <pre><code>ID    | DATE  | DELAY  | CONSECUTIVE
  101   | 1     | 1      | 1
  101   | 2     | 1      | 2
  101   | 3     | 1      | 3
  101   | 4     | 0      | 0
  101   | 5     | 1      | 1
  101   | 6     | 1      | 2
  213   | 1     | 1      | 1
  213   | 2     | 1      | 2
  </code></pre>
  
  <p>Is there a way to do it without using Pandas? If so, how do I do it?</p>