Smart Thermostat AWS Spark - part Spark upload score
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
//calculate final score | |
val fscore = (numonoffs*10*60)+(ontime*2)+((math.abs(mresultmax-testval))*150)+(overflsocre)+(tempReached) | |
//put score in used scenario | |
val confputscore = HBaseConfiguration.create() | |
val tableputscore = new HTable(confputscore,"husedscenario") | |
val putscore = new Put(rowval) | |
putscore.add("fd".getBytes(), "score".getBytes(),fscore.toString.getBytes()) | |
tableputscore.put(putscore) | |
//delete used scenario key from index table | |
val tabledelrow = new HTable(confputscore,"husedscenariotbsc") | |
val useddelete = new Delete(rowval) | |
tabledelrow.delete(useddelete) | |
tabledelrow.close() | |
tableputscore.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment