spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Reynold Xin <r...@databricks.com>
Subject Re: Coding style question (about extra anonymous closure within functional transformations)
Date Thu, 14 Apr 2016 04:11:48 GMT
We prefer the latter. I don't think there are performance differences
though.

It depends on how big the change is -- massive style updates can make
backports harder.


On Wed, Apr 13, 2016 at 7:46 PM, Hyukjin Kwon <gurwls223@gmail.com> wrote:

> Hi all,
>
> I recently noticed that actually there are some usages of functional
> transformations (eg. map, foreach and etc.) with extra anonymous closure.
>
> For example,
>
> ...map(item => {
>   ...
> })
>
> which can be just simply as below:
>
> ...map { item =>
>   ...
> }
>
> I wrote a regex to find all of them and corrected them for a PR (I did not
> submit yet).
>
> However, I feel a bit hesitating because only reasons I can think for this
> are,
>
>     firstly, Spark coding guides in both
> https://github.com/databricks/scala-style-guide and
> https://cwiki.apache.org/confluence/display/SPARK/Spark+Code+Style+Guide
> are not using the examples as above
>
>     secondly, I feel like extra anonymous closure can harm performance but
> I am too sure,
>
> which I think are not persuasive enough.
>
>
>
> To cut it short, my questions are,
>
> 1. Would this be a proper change for a PR?
>
> 2. Would there be more explicit reasons to remove extra closure not only
> for coding style?
>
>
> Thanks!
>

Mime
View raw message