I have found this answer Get the row corresponding to the latest timestamp in a Spark Dataset using Scala
"edate" is of date datatype.
I want the similar output using java. I tried this:
java.sql.Date yesterdayDate = yesterday();
Dataset<Row> wds = wddt.where(wddt.col("c").equalTo(yesterdayDate)).groupBy("mobileno").max("edate");
but I am getting this error:
org.apache.spark.sql.AnalysisException: "edate" is not a numeric column. Aggregation function can only be applied on a numeric column.;
at org.apache.spark.sql.RelationalGroupedDataset$$anonfun$3.apply(RelationalGroupedDataset.scala:101)
at org.apache.spark.sql.RelationalGroupedDataset$$anonfun$3.apply(RelationalGroupedDataset.scala:98)