title: Get first not null value spark scala on a dataframe during aggregation
body: <p>During the aggregation group by, currently I am taking the first value. But I need the first not null value for the visit_id column. Please let me know if there is any approach in Spark Scala.</p>
  
  <pre><code>DF.groupBy("id").agg(lit(first(col("visit_id"))).alias("visit_id")
  </code></pre>
  
  <p>Thanks in advance.</p>