GitHub user JoshRosen opened a pull request:
https://github.com/apache/spark/pull/13491
[SPARK-15748][SQL] Replace inefficient foldLeft() call with flatMap() in
PartitionStatistics
`PartitionStatistics` uses `foldLeft` and list concatenation (`++`) to
flatten an iterator of lists, but this is extremely inefficient compared to
simply doing `flatMap`/`flatten` because it performs many unnecessary object
allocations. Simply replacing this `foldLeft` by a `flatMap` results in decent
performance gains when constructing PartitionStatistics instances for tables
with many columns.
This patch fixes this and also makes two similar changes in MLlib and
streaming to try to fix all known occurrences of this pattern.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/JoshRosen/spark foldleft-to-flatmap
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/13491.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #13491
----
commit 50a62704362d8a0963b47cf4086e594a8f2c2f21
Author: Josh Rosen <[email protected]>
Date: 2016-06-03T05:41:12Z
Replace inefficient foldLeft calls by flatMap().
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]