GitHub user dongjoon-hyun opened a pull request:
https://github.com/apache/spark/pull/14044
[SPARK-16360][SQL] Speed up SQL query performance by removing redundant
analysis in `Dataset`
## What changes were proposed in this pull request?
Currently, there are a few reports about Spark 2.0 query performance
regression for large queries.
This PR speeds up SQL query processing performance by removing redundant
consecutive analysis in `Dataset.ofRows` function and `Dataset` instantiation.
Specifically, this PR aims to reduce the overhead of SQL query analysis, not
query execution. So, we can not see he result in the Spark Web UI. Please use
the following query script.
**Before**
```scala
scala> :pa
// Entering paste mode (ctrl-D to finish)
val n = 4000
val values = (1 to n).map(_.toString).mkString(", ")
val columns = (1 to n).map("column" + _).mkString(", ")
val query =
s"""
|SELECT $columns
|FROM VALUES ($values) T($columns)
|WHERE 1=2 AND 1 IN ($columns)
|GROUP BY $columns
|ORDER BY $columns
|""".stripMargin
def time[R](block: => R): R = {
val t0 = System.nanoTime()
val result = block
println("Elapsed time: " + ((System.nanoTime - t0) / 1e9) + "s")
result
}
time(sql(query))
time(sql(query))
// Exiting paste mode, now interpreting.
Elapsed time: 30.138142577s
Elapsed time: 25.787751452s
```
**After**
```scala
Elapsed time: 17.500279659s
Elapsed time: 12.364812255s
```
## How was this patch tested?
Manual by the above script.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dongjoon-hyun/spark SPARK-16360
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/14044.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 #14044
----
commit 1402a9d21cdce66158858560902571a9d91ac2fa
Author: Dongjoon Hyun <[email protected]>
Date: 2016-07-04T07:32:22Z
[SPARK-16360][SQL] Speed up SQL query performance by removing redundant
analysis in `Dataset`
----
---
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]