title: Spark Window Functions - rangeBetween dates
body: <p>I have a Spark SQL <code>DataFrame</code> with date column, and what I'm trying to get is all the rows preceding current row in a given date range. So for example I want to have all the rows from 7 days back preceding given row. I figured out, I need to use a <code>Window Function</code> like:</p>
  
  <pre class="lang-py prettyprint-override"><code>Window \
      .partitionBy('id') \
      .orderBy('start')
  </code></pre>
  <p>I want to have a <code>rangeBetween</code> 7 days, but there is nothing in the Spark docs I could find on this. Does Spark even provide such option? For now I'm just getting all the preceding rows with:</p>
  <pre class="lang-py prettyprint-override"><code>.rowsBetween(-sys.maxsize, 0)
  </code></pre>
  <p>but would like to achieve something like:</p>
  <pre class="lang-py prettyprint-override"><code>.rangeBetween(&quot;7 days&quot;, 0)
  </code></pre>