title: Do we have Analytical function like RANK/LAG in Spark Structured streaming
body: <p>I would like to use an Analytical function like RANK/LAG in Spark Structured streaming.</p>
  
  <ol>
  <li><p>Do we have Analytical Window function in Spark Structured Streaming by any chance?I am aware <code>org.apache.spark.sql.expressions.Window</code> is available, but this probably works with Data Frames only, not with Spark Structured streaming. Also, <code>org.apache.spark.sql.window</code> method is purely used for sliding data in window in Structured streaming.</p></li>
  <li><p>Also, Any suggestions on how to pick Max Date record in a group, in Spark structured streaming if we don’t have rank option. </p>
  
  <pre><code>val groupedOutput = joinedDf.groupBy(
      window(col("timestampIpfr"), "2 minutes"),
      col("userid"), col("timestampIpfr")
    ).agg(max("timestampMME").alias("maxTimestampMME"),
      max("locationMME").alias("locationMME")
  
  //Max on locationMME doesn't work here, looking for help on the same to find locationMME of maxTimestampMME record
  )
  </code></pre></li>
  </ol>
  
  <p>Expecting Grouped output value with max timestampMME record and corresponding locationMME</p>