scala - How to convert Option[RDD] into RDD -


this question has answer here:

i storing rdd mutable hashmap using key below.

var datasets = new hashmap[string, rdd[t]]() val feedrdd: rdd[t] = ... datasets.put("somekey", feedrdd) 

now trying fetch same rdd hashmap , returning option[rdd[t]] below

val feedrddnew = datasets.get("somekey") 

and giving error this.

expression of type option[rdd[t]] doesn't confirm expected type rdd[t]

basically want store rdd hashmap can fetch hashmap needed. thoughts on this? please let me know if wrong or alternate way. thanks!

val feedrddnew = datasets.get("somekey") 

this getter returns option[t] t type stored in map.

so, either none, or some(t)

so can do

val theactualvalue = feedrddnew.get 

or, can use

datasets("somekey") 

which doesnt return option (it throws if key not found)


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -