[ 
https://issues.apache.org/jira/browse/SPARK-11687?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hyukjin Kwon updated SPARK-11687:
---------------------------------
    Description: 
As can be seen here 
https://github.com/scala/scala/blob/2.12.x/src/library/scala/collection/TraversableOnce.scala,
 fold, reduce and reduceOption came out from scala 2.9.x. In addition, all the 
implementations of {{fold}}, {{reduce}} and {{reduceOption}} call actually 
{{foldLeft}}, {{reduceLeft}} and {{reduceLeftOption}} directly without any 
additional codes.

For developers who is not really used to scala, the mixed usage of them might 
leave a question, for example, if it works as reduceRight or reduceLeft (as all 
know, the direction can change the results). Even some usages can be found 
where they work identically the same things. 
This is just a little nit but I think it would be better to use only 
{{xxxLeft}} for readability.

  was:
As can be seen here 
https://github.com/scala/scala/blob/2.12.x/src/library/scala/collection/TraversableOnce.scala,
 fold, reduce and reduceOption came out from scala 2.9.x. In addition, all the 
implementations of fold, reduce and reduceOption call actually foldLeft, 
reduceLeft and reduceLeftOption directly without any additional codes.

For developers who is not really used to scala, the mixed usage of them might 
leave a question, for example, if it works as reduceRight or reduceLeft (as all 
know, the direction can change the results). Even some usages can be found 
where they work identically the same things. 
This is just a little nit but I think it would be better to use only xxxLeft 
for readability.


> Mixed usage of fold and foldLeft, reduce and reduceLeft and reduceOption and 
> reduceLeftOption
> ---------------------------------------------------------------------------------------------
>
>                 Key: SPARK-11687
>                 URL: https://issues.apache.org/jira/browse/SPARK-11687
>             Project: Spark
>          Issue Type: Improvement
>            Reporter: Hyukjin Kwon
>            Priority: Trivial
>
> As can be seen here 
> https://github.com/scala/scala/blob/2.12.x/src/library/scala/collection/TraversableOnce.scala,
>  fold, reduce and reduceOption came out from scala 2.9.x. In addition, all 
> the implementations of {{fold}}, {{reduce}} and {{reduceOption}} call 
> actually {{foldLeft}}, {{reduceLeft}} and {{reduceLeftOption}} directly 
> without any additional codes.
> For developers who is not really used to scala, the mixed usage of them might 
> leave a question, for example, if it works as reduceRight or reduceLeft (as 
> all know, the direction can change the results). Even some usages can be 
> found where they work identically the same things. 
> This is just a little nit but I think it would be better to use only 
> {{xxxLeft}} for readability.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to