-
Notifications
You must be signed in to change notification settings - Fork 28.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-3285] [examples] Using values.sum is easier to understand than using values.foldLeft(0)(_ + _) #2182
Conversation
Can one of the admins verify this patch? |
+1 -- you should open a JIRA though. Although there's reluctance to do cross-cutting code polish PRs, this looks targeted, restricted to example/test code, and is also something that I've wanted to zap for a while. |
+1 nice catch, the simpler the examples the easier they'll be to consume by their intended audience: folks who aren't experts yet |
Jenkins, test this please. |
LGTM pending Jenkins. sum is also much faster than fold. |
QA tests have started for PR 2182 at commit
|
QA tests have finished for PR 2182 at commit
|
Thanks. Merging this in master. |
… using values.foldLeft(0)(_ + _) def sum[B >: A](implicit num: Numeric[B]): B = foldLeft(num.zero)(num.plus) Using values.sum is easier to understand than using values.foldLeft(0)(_ + _), so we'd better use values.sum instead of values.foldLeft(0)(_ + _) Author: Yadong Qi <qiyadong2010@gmail.com> Closes apache#2182 from watermen/bug-fix3 and squashes the following commits: 17be9fb [Yadong Qi] Update CheckpointSuite.scala 714bda5 [Yadong Qi] Update BasicOperationsSuite.scala 57e704c [Yadong Qi] Update StatefulNetworkWordCount.scala
def sum[B >: A](implicit num: Numeric[B]): B = foldLeft(num.zero)(num.plus)
Using values.sum is easier to understand than using values.foldLeft(0)(_ + ), so we'd better use values.sum instead of values.foldLeft(0)( + _)