spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kali.tummala@gmail.com" <Kali.tumm...@gmail.com>
Subject Create hashmap using two RDD's
Date Fri, 09 Oct 2015 14:59:33 GMT
Hi all, 

I am trying to create a hashmap using two rdd, but having issues key not
found ....
do I need to convert RDD to list first ?

1) rdd has key data
2) rdd has value data

Key Rdd:-
val quotekey=file.map(x => x.split("\\|")).filter(line =>
line(0).contains("1017")).map(x => x(5)+x(4))

Value Rdd:-
val QuoteRDD=quotefile.map(x => x.split("\\|")).
                 filter(line => line(0).contains("1017")).
                 map(x =>
(x(5).toString+x(4).toString,x(5).toString,x(4).toString,x(1).toString ,
                 if (x(15).toString =="B") 
                       if (x(25).toString =="") x(9).toString  else
(x(25).toString),
                       if (x(37).toString =="") x(11).toString else
(x(37).toString),
                if (x(15).toString =="C") 
                       if (x(24).toString =="") x(9).toString  else
(x(24).toString),
                       if (x(30).toString =="") x(11).toString else
(x(30).toString),
                 if (x(15).toString =="A") 
                       x(9).toString,
                       x(11).toString
                    ))

Hash Map:-
val quotehash = new HashMap[String,String]
quotehash + quotekey.toString() -> QuoteRDD
quotehash("CPHI080000172")

Error:-
key not found: CPHI080000172

Thanks








--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Create-hashmap-using-two-RDD-s-tp24996.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@spark.apache.org
For additional commands, e-mail: user-help@spark.apache.org


Mime
View raw message