i have assigned following values , issue with this is that end1 and end2 values are not assigned when used inside the if statement. i have used string interpolation but still not assigned
my sample code is like this , three if conditions , one is like below
.........
.........
if(tp <="1.0")
{
end1="nd"
end2="ms"
}
breakable {
for (row <- df.rdd.collect) {
var ts=row.mkString(",").split(",")(1)
var nd=row.mkString(",").split(",")(2)
var tp=row.mkString(",").split(",")(3)
var ms=row.mkString(",").split(",")(4)
println(end1) // this prints nd
println(end2) // this prints ms
// but in if statement end1 and end2 values doesnot assign with nd and ms
- neither it shows any error nor assigning the values
if( end1 <="0.5" || end2 <="0.5")
endtime=ts
println("end timestamp is" + endtime)
break()
}
}
// i want the above if statement to be execute like
if( nd <="0.5" || ms <="0.5")
// end1 and end2 changes as per the condition
but here the value is not assigned and do go inside the if statement
Aucun commentaire:
Enregistrer un commentaire