You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Franco Barrientos <fr...@exalitica.com> on 2014/11/26 19:36:12 UTC

Map inside map

Hi all!,

 

I want to make a map insede another map, for example:

 

val tablon_perc=tablon_resp.map{p=>

val dato=(p(3).toString).toInt

val
perc=tablon_resp.map(l=>if((l(3).toString).toInt<=dato){(1)}else{(0)}).sum()

(dato,perc)

}

 

Where tablon_resp is a SchemaRDD. My idea is to calculate in perc variable
the number of observations les sor equal to each elements of tablón_resp,
but I get this error:

 



 

Is posible to make a map into another map function? Or an optional way to do
this?

 

Thx,

 

Franco Barrientos
Data Scientist

Málaga #115, Of. 1003, Las Condes.
Santiago, Chile.
(+562)-29699649
(+569)-76347893

 <ma...@exalitica.com> franco.barrientos@exalitica.com 

 <http://www.exalitica.com/> www.exalitica.com


  <http://exalitica.com/web/img/frim.png> 

 


R: Map inside map

Posted by Paolo Platter <pa...@agilelab.it>.
Hi Franco,

If I'm not wrong, Rdd is not serializable so is not possible to put it through clojure inside an other map.
The way to go is to work with join, union, zip, etc...

Paolo

Inviata dal mio Windows Phone
________________________________
Da: Franco Barrientos<ma...@exalitica.com>
Inviato: ‎26/‎11/‎2014 19:45
A: user@spark.incubator.apache.org<ma...@spark.incubator.apache.org>
Oggetto: Map inside map

Hi all!,

I want to make a map insede another map, for example:

val tablon_perc=tablon_resp.map{p=>
val dato=(p(3).toString).toInt
val perc=tablon_resp.map(l=>if((l(3).toString).toInt<=dato){(1)}else{(0)}).sum()
(dato,perc)
}

Where tablon_resp is a SchemaRDD. My idea is to calculate in perc variable the number of observations les sor equal to each elements of tabl?n_resp, but I get this error:

[cid:image001.jpg@01D0098E.B54EA2E0]

Is posible to make a map into another map function? Or an optional way to do this?

Thx,

Franco Barrientos
Data Scientist
M?laga #115, Of. 1003, Las Condes.
Santiago, Chile.
(+562)-29699649
(+569)-76347893
franco.barrientos@exalitica.com<ma...@exalitica.com>
www.exalitica.com
<http://www.exalitica.com/>
[http://exalitica.com/web/img/frim.png]