Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Smart Thermostat AWS Spark - part Spark score 2
val testval = (valsettemp*10) //temperature to be reached
var tempReached : Long = 70L*60L
val valFirstTempR = valRows.filter(r => r._2 >= testval)
valFirstTempR.cache()
val valFirstTempRhap : Long = valFirstTempR.count()
println("numonovermax")
println(valFirstTempRhap)
if (valFirstTempRhap > 0L) {
val valFirstTempRval : Long = (valFirstTempR.sortByKey().take(1))(0)._1.toLong
println("reached max")
println(valFirstTempRval)
tempReached = valrevepoch - valFirstTempRval //after how many seconds set temperature was reached
}
val mresultmax : Int = ((valRows.map(item => item.swap).sortByKey(false).take(1))(0))._1.toInt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment