spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacek Laskowski <ja...@japila.pl>
Subject Re: Add the sql record having same field.
Date Sun, 06 Mar 2016 08:30:12 GMT
What about sum?

Jacek
06.03.2016 7:28 AM "Angel Angel" <areyouangel90@gmail.com> napisaƂ(a):

> Hello,
> I have one table and 2 fields in it
> 1) item_id and
> 2) count
>
>
>
> i want to add the count field as per item (means group the item_ids)
>
> example
> Input
> itea_ID Count
> 500 2
> 200 6
> 500 4
> 100 3
> 200 6
>
>
> Required Output
>
> Result
> Itea_id Count
> 500 6
> 200 12
> 100 3
>
>
> I used the command the  Resut= Input.groupBy(Item_ID).count()
> output is
>
> 500   2
> 200   2
> 100    1
>
> so how can i get the above output?
>
> Thnaks
>

Mime
View raw message