Aggregate data based on timestamp in JavaDStream of spark streaming

旧城冷巷雨未停 提交于 2019-12-14 01:56:43

问题


I am writing a spark streaming job in java which takes input record from kafka. Now the record is available in JavaDstream as a custom java object. Sample record is :

TimeSeriesData: {tenant_id='581dd636b5e2ca009328b42b', asset_id='5820870be4b082f136653884', bucket='2016', parameter_id='58218d81e4b082f13665388b', timestamp=Mon Aug 22 14:50:01 IST 2016, window=null, value='11.30168'}

Now I want to aggregate this data based on min, hour, day and week of the field "timestamp".

My question is, how to aggregate JavaDstream records based on a window. A sample code will be helpful.

来源:https://stackoverflow.com/questions/40903096/aggregate-data-based-on-timestamp-in-javadstream-of-spark-streaming

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!