title: Spark 1.5.2: Grouping DataFrame Rows over a Time Range
body: <p>I have a <code>df</code> with the following schema:</p>
  
  <pre><code>ts: TimestampType 
  key: int 
  val: int
  </code></pre>
  
  <p>The <code>df</code> is sorted in ascending order of <code>ts</code>. Starting with row(0), I would like to group the dataframe within certain time intervals. </p>
  
  <p>For example, if I say <code>df.filter(row(0).ts + expr(INTERVAL 24 HOUR)).collect()</code>, it should return all the rows within the 24 hr time window of row(0).</p>
  
  <p>Is there a way to achieve the above within Spark DF context? </p>