spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mdkhajaasm...@gmail.com
Subject Re: Question on how to access tuple values in spark
Date Sat, 06 Feb 2016 23:45:24 GMT


Sent from my iPhone

> On Feb 6, 2016, at 4:41 PM, KhajaAsmath Mohammed <mdkhajaasmath@gmail.com> wrote:
> 
> Hi,
> 
> My req is to find max value of revenue per customer so I am using below query. I got
this solution from one of tutorial in google but not able to understand how it returns max
in this scenario. can anyone hep
> 
> revenuePerDayPerCustomerMap.reduceByKey((x, y) => (if(x._2 >= y._2) x else y))
> 
>  ((2013-12-27 00:00:00.0),(62962,199.98))
>  ((2013-12-27 00:00:00.0),(62962),299.98))
> 
> 
> why doesn't the below statement work to get max?
> 
> x._1>=y._1 ? btw, what is value of x._1,x._2,y._1,y._2 in this scenario. 
> 
> Thanks and waiting for your responses.
> 
> Regards,
> Asmath

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


Mime
View raw message