Smart Thermostat AWS Spark - part Spark score 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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