How to get Customer id with max revenue for each day by dataframe operation

I am trying get Customer id with max revenue for each day by using dataframe operation, But got stuck at last step. I am using below code

val joinDF = ordersDF.join(orderItemsDF, ordersDF(“order_id”) === orderItemsDF(“order_item_order_id”))
val a = joinDF.groupBy(“order_date”,“order_customer_id”).agg(sum(“order_item_subtotal”).alias(“revenue”))
val b =“d1”).select($“d1.*”).sort($“d1.order_date”,$“d1.revenue”.desc)

and my out put is

| order_date|order_customer_id| revenue|
|2013-07-25 00:00:…| 11941| 1649.800048828125|
|2013-07-25 00:00:…| 5293| 1629.800048828125|
|2013-07-25 00:00:…| 6789|1499.8700256347656|
|2013-07-25 00:00:…| 1837|1299.8700256347656|
|2013-07-25 00:00:…| 8504|1279.6499786376953|
|2013-07-25 00:00:…| 656|1159.9000129699707|
|2013-07-25 00:00:…| 9111|1149.9400329589844|

Like above I am getting for each day. I just want to pick top record from each day for the final output.

I am able to get the desired output using core spark API.

Kindly help.

You might not able to get every thing using data frame operations. From here, I will go with Spark Core APIs to get top customer id by revenue for each day.

Thank you sir, will do the same.