title: How to use same windows partition over different analytical function in optimal way?
body: <p>I have a question on the below code. I am using the same windows partition and running different functions such as max, min and row_number on it. Does Spark perform the windows partitioning every time I refer in <code>withColumn</code> or does it performs windows partitioning optimally one time as it encounters multiple functions on the same windows partition?</p>
  
  <pre><code>val windows = Window.partitionBy("id").orderBy(col("date").desc)
  
  dataframe.withColumn("max", max(col("column1")).over(windows))
           .withColumn("min", min(col("column2")).over(windows))
           .withColumn("row_number", row_number().over(windows))
  </code></pre>