title: How to divide the value of current row with the following one?
body: <p>In Spark-Sql version 1.6, using <code>DataFrame</code>s, is there a way to calculate, for a specific column, the fraction of dividing current row and the next one, for every row?</p>
  
  <p>For example, if I have a table with one column, like so</p>
  
  <pre><code>Age
  100
  50
  20
  4
  </code></pre>
  
  <p>I'd like the following output</p>
  
  <pre><code>Franction
  2
  2.5
  5
  </code></pre>
  
  <p>The last row is dropped because it has no "next row" to be added to.</p>
  
  <p>Right now I am doing it by ranking the table and joining it with itself, where the <code>rank</code> is equals to <code>rank+1</code>.</p>
  
  <p>Is there a better way to do this?
  Can this be done with a <code>Window</code> function?</p>