GitHub user davies opened a pull request:
https://github.com/apache/spark/pull/13871
[SPARK-16163] [SQL] Cache the statistics for logical plans
## What changes were proposed in this pull request?
This calculation of statistics is not trivial anymore, it could be very
slow on large query (for example, TPC-DS Q64 took several minutes to plan).
During the planning of a query, the statistics of any logical plan should
not change (even InMemoryRelation), so we should use `lazy val` to cache the
statistics.
For InMemoryRelation, the statistics could be updated after
materialization, it's only useful when used in another query (before planning),
because once we finished the planning, the statistics will not be used anymore.
## How was this patch tested?
Testsed with TPC-DS Q64, it could be planned in a second after the patch.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/davies/spark fix_statistics
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/13871.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 #13871
----
commit bd786fafb799e62e6a0d165bbf50722b4fe28539
Author: Davies Liu <[email protected]>
Date: 2016-06-23T06:40:17Z
cache statistics on logical plan
commit ecdf2b867467f443363430ab7b57d1db9f2d9ed5
Author: Davies Liu <[email protected]>
Date: 2016-06-23T06:56:45Z
cleanup statistics in InMemoryRelation
----
---
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]