title: how to use spark lag and lead over group by and order by
body: <p>i use : `</p>
  
  <pre><code>dataset.withColumn("lead",lead(dataset.col(start_date),1).over(orderBy(start_date)));
  </code></pre>
  
  <p>`
  i just want to add group by trackId so lead work over each group by as any agg function : </p>
  
  <pre><code>+----------+---------------------------------------------+
  |  trackId |  start_time    |  end_time   |      lead    |
  +-----+--------------------------------------------------+
  |  1       | 12:00:00       |   12:04:00  |     12:05:00 |
  +----------+---------------------------------------------+
  |  1       | 12:05:00       |   12:08:00  |    12:20:00  |  
  +----------+---------------------------------------------+
  |  1       | 12:20:00       |   12:22:00  |     null     | 
  +----------+---------------------------------------------+
  |  2       | 13:00:00       |   13:04:00  |    13:05:00 |
  +----------+---------------------------------------------+
  |  2       | 13:05:00       |   13:08:00  |    13:20:00  |  
  +----------+---------------------------------------------+
  |  2       | 13:20:00       |   13:22:00  |     null     | 
  +----------+---------------------------------------------+
  </code></pre>
  
  <p>any help how to do that ?</p>