title: Migrating window functions from SQL to spark scala
body: <p>Here's some SQL expression that I'm trying to migrate to spark scala.</p>
  <pre><code>SELECT
   a.senderId,
   b.company_id,
   ROW_NUMBER() OVER(PARTITION BY a.senderId ORDER BY b.chron_rank) AS rnk
  FROM df1 a
  JOIN df2 b
  ON a.senderId = b.member_id
  WHERE a.datepartition BETWEEN concat(b.start_date,'-00') AND concat(b.end_date,'-00') 
  </code></pre>
  <p>I'm a little lost with the window function,
  I started something like this,</p>
  <pre><code>val temp = df2.join(df1, $&quot;dimPosition.member_id&quot; === $&quot;df1.senderId&quot;)
      .select($&quot;df1.senderId&quot;, $&quot;df2.company_id&quot;)
      .......
  </code></pre>