-
- Downloads
[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. Author: Davies Liu <davies@databricks.com> Closes #13871 from davies/fix_statistics.
Showing
- sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/basicLogicalOperators.scala 10 additions, 10 deletions...rk/sql/catalyst/plans/logical/basicLogicalOperators.scala
- sql/core/src/main/scala/org/apache/spark/sql/execution/columnar/InMemoryRelation.scala 19 additions, 46 deletions...pache/spark/sql/execution/columnar/InMemoryRelation.scala
- sql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala 1 addition, 2 deletionssql/core/src/test/scala/org/apache/spark/sql/QueryTest.scala
Loading
Please register or sign in to comment