How to verify and replace all values in a tuple. In example below I want to replace all elements in a tuple to be replaced with 0 whenever the element value is NA. Is their any generic statement rather then verifying elements individually?
eg:
b= RDD[String]
Sample Data
2003,1,29,3,1651,1655,1912,1913,UA,1017,N202UA,141,138,119,-1,-4,ORD,MSY,837,5,17,0,NA,0,NA,NA,NA,NA,NA 2003,1,30,4,1654,1655,1910,1913,UA,1017,N311UA,136,138,108,NA,NA,ORD,MSY,837,2,26,0,NA,0,NA,NA,NA,NA,NA
Desired c = (1017,-1,-4,ORD,MSY) (1017,0,0,ORD,MSY)
val c = b.map( x => x.split(",")).map(x => (x(9),x(14),x(15),x(16),x(17))).map(x => if (_._ == "NA") "0" else _._)