Skip to Content
Industrial Internet Application Development
book

Industrial Internet Application Development

by Alena Traukina, Jayant Thomas, Prashant Tyagi, Veera Kishore Reddipalli
September 2018
Intermediate to advanced
412 pages
11h 12m
English
Packt Publishing
Content preview from Industrial Internet Application Development

Windows-based calculations

Spark provides the ability to run Windows-based operations by aggregating the data for a feature continuously. Here is an example where the KPI average of heat rate is being calculated on a weekly basis over time. Windows-based calculations can be applied to both batch and streaming data to calculate the average:

powerDF.groupBy(window(powerDF.col("Date"),"1 week")).agg(avg("heatrate").as("weekly_average"))+-------------------+-------------------+------------------+|start |end |weekly_average |+-------------------+-------------------+------------------+ |2017-04-13 17:00:00|2017-04-20 17:00:00|208.5694 ||2017-04-20 17:00:00|2017-04-27 17:00:00|203.5780 ||2017-04-27 17:00:00|2017-05-04 17:00:00|299.5316 ||2017-05-04 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On Industrial Internet of Things

Hands-On Industrial Internet of Things

Giacomo Veneri, Antonio Capasso
What Employees Want Most in Uncertain Times

What Employees Want Most in Uncertain Times

Kristine W. Powers, Jessica B.B. Diaz

Publisher Resources

ISBN: 9781788298599Supplemental Content