I see spark can do this by UDF.
Aggregation with Group By date in Spark SQL <http://stackoverflow.com/questions/30052937/aggregation-with-group-by-date-in-spark-sql> http://stackoverflow.com/questions/30052937/aggregation-with-group-by-date-in-spark-sql -- 朴元奎 kerwin