I have a json like this:
[
{
"ser": 345,
"City": "New York",
"Gen": 1
},
{
"ser": 55,
"City": "New York",
"Gen": 2
},
{
"ser": 19,
"City": "New York",
"Gen": 3
}
]
I want to make some query to this json ( example: SELECT SUM(ser) AS Serlab, City, Gen FROM libri GROUP BY City, Gen ORDER BY City)...i need spark rdd to make this.
After this query i should modify the structure of my input json in this new:
[ { "label": [1,2,3] //that is the Gen value,
"values": [
{ "label":"New York"
"values":["200","10","66"] //is the ser about all Gen (for eexample 200 is ser is for label/gen 1 .. 10 is for label/gen 2 etc.
},
{ "label":"London"
"values":["500","150","46"]
},
{ "label":"London"
"values":["500","150","46"]
},
.
.
.
.
.
]
}
]
And then i send this new JSON to a Http request How can i make this in scala,play,spark? Please help me :)